Hi all.
Let me explain a bit the app i'm doing.
I'm creating a central UDP (needs to be UDP) server for multiple and concurrent clients that also "talk" between them. I do a check into a dict of known clients addresses and create a client handler thread if "i dont know" the client. Else, the thread receives the data ad does its job. The new thread receives a reference to the socket and the caller address, so they use socket.sendTo with that address and the data.
The problem appears when a client closes it's client (Alt+F4) and someone talks to em, cause the socket throws a 10054 error, "Socket connection reset". Not expected in UDP, i think. The "talk" method on the client threads is also between try & except tags but still, is the UDP server "recvfrom" the one that triggers the exception.
I am using Python 2.5 (need it for the code) and this socket options:
host = "0.0.0.0"
port = 10000
UDPSock = socket(AF_INET,SOCK_DGRAM)
UDPSock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
UDPSock.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
UDPSock.bind((host,port))
There are some options that let me do what I wanted or a library that solves this things?.
Or If i am doing it wrong... there is a way to do/emulate the same behavior as threaded TCP socket (create a new client handler thread on accept) but with UDP?
Thanks for reading ;)