MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / queryServer

Method queryServer

src/namecoin.py:225–245  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

223
224 # Helper routine sending data to the RPC server and returning the result.
225 def queryServer (self, data):
226 try:
227 s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
228 s.setsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
229 s.settimeout(3)
230 s.connect ((self.host, self.port))
231 s.sendall (data)
232 result = ""
233
234 while True:
235 tmp = s.recv (self.bufsize)
236 if not tmp:
237 break
238 result += tmp
239
240 s.close ()
241
242 return result
243
244 except socket.error as exc:
245 raise Exception ("Socket error in RPC connection: %s" % str (exc))
246
247# Look up the namecoin data folder.
248# FIXME: Check whether this works on other platforms as well!

Callers 1

callRPCMethod · 0.95

Calls 3

connectMethod · 0.45
recvMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected