CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: C# Sockets for Game

  1. #1
    Join Date
    Dec 2011

    Question 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.

  2. #2
    Join Date
    Feb 2011
    United States

    Re: C# Sockets for Game

    See my post on this recent thread:, in particular the asynchronous examples.
    Best Regards,

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)