In article <[EMAIL PROTECTED]>, 7stud <[EMAIL PROTECTED]> wrote:
> If two sockets are bound to the same host and port on the server, how > does data sent by the client get routed? Can both sockets recv() the > data? Undefined. You certainly won't find the answer in the RFCs which define the protocol because sockets aren't part of the protocol. Unfortunately, you won't find the answer in the Socket API documentation either because the socket API documentation is pretty vague about most stuff. One possible answer is that the operating system won't let you bind two sockets to the same (address, port) pair. But, another possibility is that it will. And even if it won't, consider the case of a process which forks; the child inherits the already bound socket from the parent. So, either way, you're left with the question, what happens with two sockets both bound to the same (address, port) pair? For the sake of simplicity, I'm assuming UDP, so there's no connection 4-tuple to worry about. The answer is, again, undefined. One reasonable answer is that packets received by the operating system are doled out round-robin to all the sockets bound to that port. Another is that they're duplicated and delivered to all sockets. Anything is possible. But, as other posters have said, this really isn't a Python question. This is a networking API question. Python just gives you a very thin layer on top of whatever the operating system gives you, and lets all the details of the OS implementation quirks shine through. -- http://mail.python.org/mailman/listinfo/python-list