December 20th, 2011, 07:09 PM
C# Sockets for Game
So I am trying to figure out how to send information(like player coordinates, health, etc) from one client to another (peer to peer or server/client; doesn't matter). What is the methodology to do so?
What I mean is: I can code a console based P2P chat program. That is a no-brainer. However, I want to make a graphical program (using windows forms/XNA) and want to be able to move a character around the screen. How would I take care of making the connection? Meaning: the users will have to type in the desired IP address somehow. Would I use a separate Console? Would I use IO? If so, how would I do all of this?
I am very new to sockets and such and have NO idea as to a good way to create a connection and manage a connection for a program that isn't in console.
I don't want it to appear as though I don't know a thing about C# or programming in general. I am extremely compitent with C# and have been using XNA to learn how to manipulate graphics on a screen. After messing with some socket/type things using console I wanted to integrate a very simple communication between clients into a very simple XNA game project (like seeing other clients move a character around a screen [or only one other client if using a simple P2P])
Last edited by Thromshall; December 20th, 2011 at 07:51 PM.
December 22nd, 2011, 01:44 AM
Re: C# Sockets for Game
See my post on this recent thread: http://www.codeguru.com/forum/showthread.php?t=519429, in particular the asynchronous examples.
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
Tags for this Thread
Click Here to Expand Forum to Full Width