The service side
# s server object is binding the local port 8080
S=SimpleXMLRPCServer ((8080) "10.249.91.36)
# will function the add registration to s
S.r egister_function (add_funcyion, "add")
S.r egister_function (sayHello, "say")
S.r egister_function (connetClient, "connetClient")
# start the service
S.s erve_forever ()
The client
Def connetServer (self, count) :
StartTime=time. Time ()
C=ServerProxy (" http://10.249.91.36:8080 ")
# c=ServerProxy (" http://10.249.91.64:1234 ")
For I in range (1, count + 1) :
# getresult=Arthur c. onnetClient (" rpcTest ")
Getresult=c.a. dd (I, I)
GetNmu=I
2=time. Time () - startTime
Print (" from the server to get the results: ", getresult, "; Carried out ", getNmu, "time")
Print (" TPS: "count/2)
Service is open, run the client, part of the display ConnectionRefusedError: [10061] WinError because the target machine actively refused, unable to connect, call the service side method failed, but some call server method is successful, the server has a print calls a method of
O great god teach
CodePudding user response:
Sure is which confused you, you can reduce your code validation problemsCodePudding user response:
The building Lord, this problem solved?SimpleXMLRPCServer is single-threaded mode (multi-threading versions and ThreadingMixIn derive new class), but I just want to use the single thread model, make all clients queuing RPC, also met your situation: concurrent process (single-threaded mode) at the same time, general before 6-8 client calls to complete, is greater than the number of the other clients about 4 seconds later, the ConnectionRefusedError: [10061] WinError because the target machine actively refused, unable to connect,