Advertisement

my little socket server

Started by March 04, 2005 01:20 PM
0 comments, last by hplus0603 19 years, 11 months ago
I am a newbie when it comes to network programming. I've read through MUD Game Development and I've read quite a bit on the internet about it, and I thought I might try to implement my own little TCP socket server. I'm going to be writing this in python. I've looked at the SocketServer module in python but I can't find sample code or explanations of it on the internet anywhere. Anyone have any links about that? Anyways here's a diagram of my plan. I'm only going to make it support TCP and I want the server to be abstract so it'll work for lots of things but to play with it I'm going to create a MUD server. The connection thread will do the actual listening on the socket, the socket will be non-blocking so it can also send data if there's data to send. Each connection is added to a list in the "connection server" and each connection also has a buffer of data. To send data to the socket, simply add data to the send buffer in the connection object. When data is received from the socket it is automatically dropped into the "received" buffer in the connection object. Mutexes and accessors/mutators make sure everything is nice and safe to play with. Anyone see any immediate problems? Am I completed whacked?
You can make that work just fine. If you stay at reasonable (i e not "massive") connection counts, it probably will perform well enough, too.

Good luck with your project!
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement