Some advice was given here
Python Sockets use function instead of global socket call
and I thought it was working but now seems to not be any ideas on how to make the following code work?
def testMethod():
socks = {}
socks['i'] = createConnection(host, port)
socks['i'].send("Hello world")
print "Sent Hello World"
This is the error message I get
'int' object has no attribute 'send'
*cheers
and ty for any advice
The problem is in your createConnection function. It is returning an int rather than a socket. Can you share your implementation of createConnection?
To make this more answer like:
In your case, createConnection is returning an integer, a socket handle perhaps, but I’m guessing because the implementation isn’t available.
the method should look something like