title: C# network setup for XNA video game
body: <p>So I'm building a little game for a small project that will have a server and 4 clients, one of which will be on the server pc. The problem I'm having is finding a good tutorial for setting up server/client connections. The one I DID find was
  <a href="https://www.youtube.com/watch?v=ObcGBT4ZWEU" rel="nofollow">https://www.youtube.com/watch?v=ObcGBT4ZWEU</a></p>
  
  <p>But when I try to use it in my XNA game, I get errors saying is a 'field' but is used like a 'type' with <code>
          sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
          sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);</code></p>
  
  <p>The overall portion looks like this. I've cut out the bottom part because it doesn't partain. </p>
  
  <pre><code>public class Game1 : Microsoft.Xna.Framework.Game
  {
          GraphicsDeviceManager graphics;
          SpriteBatch spriteBatch;
          List&lt;string&gt; receiveMsgs = new List&lt;string&gt;();
          Socket sck;
          EndPoint epLocal, epRemote;
          sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
          sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
          string localip = GetLocalIP();
          string friendsIp = GetLocalIP();
  
          public Game1()
          {
  </code></pre>
  
  <p>If anyone has any good tutorials on how to do what I'm trying to do, it would greatly be appreciated.</p>