Networking in XNA using System.Net (Sockets)
I have been working hard this past week on a couple of classes (two components) for my XNA engine, Xna5D. These two components have been an Asynchronus TCP Server and Client for networking purposes. I have finally got the code to be working stable enough to show it off a bit. I have wrapped the basic Socket classes and exposed callbacks via Delegates/Events. The XNA Game Component portion can be easily stripped off (I only use it for getting a reference to an XmlLogger component). Speaking of which, if you do try to use these you will need to strip that out (Referencing XmlLogger) unless you have the full Xna5D source. It is pretty easy to do though.
A link to the source code (zip)...
http://downloads.jsedlak.org/Xna5D_ClientServer.zip
A link to just the client and server classes...
http://downloads.jsedlak.org/AsyncTcpClient.cs
http://downloads.jsedlak.org/AsyncTcpServer.cs
To use the classes simply instantiate them, hook into the events and then...
For Server:
server.Start(); < Starts with listening to any IP and on port 11000.
For Client:
client.Connect("127.0.0.1", 11000);
There is still a lot of work to do and a couple of events to add but I am happy so far! These classes will be included in Xna5D Beta 1 release which is scheduled for mid December right now (I am waiting on XNA RTM). Any feedback and comments are appreciated!

