instant-messagingp2p

How to build a simple 2-player game, communicating over the internet, with no custom code on any server?


How can I build a simple 2-player game, that communicates over the internet?

I need to solve the problems of:

In this regard, I suppose it is equivalent to a 2-way chat, where people want to be able to find each other, and then also, once paired up, intercommunicate.

Further requirements:

  1. for now, assume the endpoints are Windows OS, relatively recent.

  2. assume neither endpoint machine is directly accessible from the internet. Assume they are client machines, hidden behind firewalls that block incoming requests. The machines can make outbound requests. (say, over HTTP, but TCP is also fine)

  3. communication should be private. For simplicity, let's say there's a shared secret already in place, and the endpoints are able to do AES. I guess what I mean by this is, any intermediary should not need to decrypt the message packets. The decryption will happen only at the endpoints.

  4. all custom code should run only on the client PCs.

  5. Assume there is no server in the internet that is under my control.

  6. I'm happy to use third-party servers to facilitate intercommunication, like an IM server or something, as long as it's free, and I am not required to install custom code on it.


What APIs are available to facilitate this design?

Can I do this with IM APIs? WCF? Are there WCF Channels for Windows Messenger?

What protocols? HTTP? I have this tagged as "peer-to-peer" but I mean that virtually; there's no hard requirement for a formal p2p protocol.

What message formats would you use?


EDIT

To clarify the requirements around servers, what I want is NO SERVER UNDER MY CONTROL. And NONE OF MY CUSTOM CODE ON ANY SERVER. That is not the same as "No server".

Think of it this way: I can send an email over SMTP, using custom code that I write on the sending and receiving side. My custom code can connect via a free SMTP server intermediary. This would require no installation of code on the SMTP server. This is something like what I want, but SMTP is not acceptable, because of the latency.

EDIT2
I also found this: library for Instant Messaging, like libpurple, but written in C#


ANSWER

I can do what I want, using libraries for IM frameworks. One simple way to do it using Windows Live Messenger is to use the Messenger Activity SDK. This proves the concept, but is not really a general solution. But, similar things can be accomplished with the IM libraries for various messenger systems, like libpurple, or using libs for IRC channels. In all these cases, the IM servers act as the firewall-penetrating communications infrastructure.


Solution

  • libpurple along with otr can give you the privacy-over-IM such an application would need.