I am learning to use HTML5 WebSockets and as part of that I am writing a server in Python so I can know the nitty gritty of how they work. I created one the other day that w
You can't send sockets to forked processes without using deep unix magic. You can read the book Advanced Programming in the Unix environment if you really want to see how it is done in C.
For an easy solution change to using threading and your code will probably just work. While threading is not perfect in Python it is pretty good for doing IO intensive stuff.
Alternatively create your listening socket before forking and get all the subprocesses to listen (call accept
). The os will ensure that only one of them gets the connection. This is the way preforking servers are usually written.