Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect 2 Computers with .NET

Tags:

c#

I'm working on an online version of Connect 4, and I want to be able to connect 2 computers together.

I have some knowledge on creating networks between computers the TcpClient and Listener classes, however to my knowledge these only work on computer connected to the same network (LAN)

I want to be able to be on a different part of the Earth and play connect 4 with my little sister, regardless on what LAN we are on.

Is this possible?

like image 844
Overload119 Avatar asked Aug 26 '10 18:08

Overload119


2 Answers

Yes.

Connecting two computers on a LAN is the same as connecting over the Internet. The only differences are:

  • You will need to connect based on your external ip address instead of your local (try http://whatismyipaddress.com)
  • You will need to ensure that your router understands to redirect incoming traffic to your computer (your external IP address maps to your router. You need to ensure the router makes the connection back to your computer).

Without a more specific question, I can't get more detailed than that.

like image 112
riwalk Avatar answered Oct 21 '22 06:10

riwalk


Take a look at Jabber, it is an instant messaging protocol (used by Gtalk). Hookup with either a public jabber server or setup your own Jabber host. Jabber-net is a library for .NET

You can extend it to do pretty much all you want including gaming etc.

like image 25
Mikos Avatar answered Oct 21 '22 07:10

Mikos