Windows Phone 7 Sockets and File System Libraries

I never got a chance to write a blog post about it because my last blog got too painful to even use.  Here are two libraries that will only work on developer phones.  Do not expect to get applications written with them passed the market place approval.  They are only made for fun.


This library I wrote is very similar to the System.Net sockets class.  I never built any code to host a socket, but others have taken it and added it to make things like a WP7 web server.

File System

This library is very similar to the System.IO classes to read a directory or a file via a file stream.  The phone is pretty locked down, so the only place I’ve been able to read is the \Windows folder.  There are several ways to get those files off the phone.  One ingenious solution given to me by a good friend (not sure he wants to be named or not) is to base64 the file and view it in the text viewer in the debugger.  The other way is to upload the file to a web server…or use the sockets library above.

Happy Hacking!


  1. Koen Zwikstra

    Hey Jeremiah,

    Running your sockets library raises a COMException (COM object with CLSID ‘{A3EABD8D-6578-4BB8-8228-9D20C45EE1D6}’ cannot be created due to the following error: The network request is not supported. .)

    I am missing something? (running 2011 January Update)


  2. Trackback: Microsoft Weblogs
  3. chennapavan

    Hi jeremiahmorrill,

    you have suggested Koen Zwikstra to convert to x86 dll.
    can you tell me how to do that.

    thank you.

  4. Pingback: Linksammlung 13/01/2011 | Silverlight, WPF & .NET
  5. Marek


    I used your library to connect to the socket server. Everything worked smoothly, successful connection has been made with .net socket server through WLAN. But after i’ve disconnected usb cable and not started application from Visual Studio, exception was being thrown and phone couldn’t connect anymore to the server. Do you think that unmanaged code can’t work on device without being connected to the developer machine ?

    Thanks in advance for the answer.

  6. Jan de Vries

    Hi Marek.

    I have the same experience, trying to build a jabber client. Jabber uses port 5222. Jer’s sockets library works great as long as my phone is connected to my PC via USB. But once it has to work via wifi, the sockec won’t connect to port 5222 on the jabber server…

    Kind regards,

    • Jan de Vries

      I have to correct my post above; finally I found out that I had to set the correct properties for the WPInteropManifest.xml file. This file has to be added to the project and then you’ll have to specify the following properties for this file:
      – build action: Content
      – copy to output directory: always

      Then it works like a charm!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s