I have this piece of code in which I try to send an UDP datagram in a new thread
import threading, socket
address = ("localhost", 9999)
def send(sock):
sock.sendto("Message", address)
print "sent"
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
threading.Thread(target=send, args=(s)).start()
But when I try to give the socket as an argument to the function, a TypeError exception is thrown:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in
self.__target(*self.__args, **self.__kwargs)
TypeError: send() argument after * must be a sequence, not _socketobject
What that means?