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!

[2252 byte] By [jsedlak] at [2007-12-27]
# 1

Looks pretty nifty. Only wondering why folks don't just use camelcase, this isn't C++

The main reason I'm posting though is that I thought the System.Net namespace will not be available on the XBox 360. I don't know if anything changed about that, but if it indeed isn't available, it would be a useful release note that this code can only be used on Windows.

RimvanWersch at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2
System.Net won't be available on the 360, at least not in v1.0.
JimPerry at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 3
Odd, I thought it was. Guess the next question to be asked is what are we supposed to do for networking on the 360?
jsedlak at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 4
Nothing, at the moment. Microsoft have said that they would like to change that in the future.

Cheers,
Leaf.

Leaf. at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 5

jsedlak wrote:
Odd, I thought it was. Guess the next question to be asked is what are we supposed to do for networking on the 360?

From the FAQ:

Q: Do we have network or Xbox Live access on the Xbox 360 via the XNA Framework?
A: On Windows you can use System.Net or any other network library. On Xbox 360 there is no network support. Local multi-player support is supported on the Xbox 360 however.

Like Leaf said, you don't do anything for networking on the 360 because it's not available. You can do split screen however.

JimPerry at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...