A little bit of background first: I'm thinking of writing a MUD server (well, it's more like an extensible MUD engine, such as the Gecko engine is to web browsers). I'm thinking of writing it in Perl for a variety of reasons, then backporting parts of it to C if speed becomes an issue. Unfortunatly, right now I'm stuck at the very beginning.
I've looked over examples of sockets code, I read the IPC chapter in the Camel, looked at a few C primers on networking and sockets and did my research. As far as I can tell there are three main ways to deal with multiple concurrent connections and I don't know which one would be best for the job I'm trying to do.
From what I've seen, you can use fork() to split off a child for each open connection, use select() to switch between sockets, or use a threaded model.
Can anyone tell me what the advantages and disadvantages to each of these models would be, aside from the obvious (threads require threadsafe modules and so forth)? Why should I choose one model over another? What are the limitations of each model? What are the benefits? What are the common gotchas and pitfalls for implementing each of the models? Am I going to run into portability problems trying to move between Win32/Cygwin and Unix?
To sum up my problem, There's More Than One Way To Do It But Which Way Is Best?
Much obliged.
In reply to Sockets: TMTOWTDI (BWWIB)? by Ionizor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |