Search code examples
c#tcpudpchatp2p

Creating a P2P Application with TCP/IP?


I am working on creating a C# P2P chat messenger without a central server. And I need help on how i should start implementing the model.

I have in mind to send out a UDP broadcast to all the computers on the network. Then the receiving computer would receive it, and add that new peer to a hashtable. Then using a TCP server embed in each program. The messages would be broadcast in TCP to all computers listed in the hashtable. And the other peer would receive it and then send out their own message. Is this a viable way of creating a peer2peer chat application, or is there a better way to do it?


Solution

  • You can use WCF's NetPeerToPeer binding which behind the covers does about the same thing. You're reliant on MS networks though to link the nodes together in the cloud.

    WCF Peer to Peer, Are There Nodes Out There?

    http://msdn.microsoft.com/en-us/library/cc297274.aspx

    http://msdn.microsoft.com/en-us/magazine/cc700336.aspx

    http://msdn.microsoft.com/en-us/magazine/dd882514.aspx