Making the TCP/UDP Socket Samples Work a Real Phone


Windows Phone 7.5 (Mango) brings us sockets as another means for us to use data from the Internet. MSDN provides two pretty sweet samples in the UDP and TCP how-to samples. Basically each sample socket connects to the TCP/IP Simple Services Echo and Quote of the Day. The samples do tell a user how to install the TCP/IP Services on their own machine to run the samples while the phone is tethered to your desktop or laptop.

Unfortunately, this does nothing for you if you want to run the samples from a physical phone that isn't tethered to your PC. You need to enter a hostname or IP that's running simple TCP services out in the wild Internet. Eerily enough, it was hard as heck to try and find a public server running simple TCP/IP Services. I binged around and even hit some internal Microsoft email lists looking for a public Microsoft owned server running simple TCP Services that I could hit for demos and such. Ah well, no luck.

But, luckily for me, my website isn't a just a simple (ugly) IIS Web Site. Devfish is actually a Virtual Private Server from an awesome Florida based hoster, Applied Innovations. I've got a full virtual server out there I can install anything I want on. Sooo, I installed the Simple TCP/IP Services onto "". To use the samples on a "real phone" simply point the Host Name over to "". Done.


If you want to download the samples already coded, and not have to key them in, I've shared them out at [ ]. I added a few items to the samples such as saving the hostname from session to session, and trapping the socketexceptions if the host is invalid. I also chopped the SocketClient classes out to separate TCP and UCP classes.  Enjoy.

socket-menu socket-tcp socket-udp

More socket goodness and resources are available at my ScrewTurn Wiki -  .

(I want to be a real boy! said Pinnochio)

Comments (4)

  1. wolfgang hauer says:


    Have you ever can run the sample successfull on a real device? It works tethered, with wifi to but not on a gsm data connection. IE is ok.

    thank you


  2. jhealy says:

    wolfgang – yeah, runs fine on my dell venue pro / tmobile with no wireless.  

  3. wolfgang hauer says:

    Found it – my phone was from the provider configured for WAP

    Now works perfect

    Thanks, Wolfgang

  4. jhealy says:

    wolfgang, glad to hear!

Skip to main content