Click here to Skip to main content
14,026,166 members
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 16 Mar 2011
Licenced CPOL

IP Relay for Visual Studio Mobile Device Web Development

, 16 Mar 2011
Rate this:
Please Sign up or sign in to vote.
Enable access from mobile phone emulator to Visual Studio WebDev.WebServer listening on localhost

The Problem

Have you tried to develop a mobile device application that is using web services? If you did and if you had the web service running on your localhost WebDev.WebServer.EXE, then you may have found out that the web service is only listening to IP address and there is no way you can connect from the mobile device emulator to the web service (because the device is its internal address). I am guessing that MSFT didn’t want developers to use their development environment for commercial use so the access from the network is blocked.

So you have a mobile device application that is using web service and you don’t have IIS or other web server to run your service. I have searched the net for an answer and found nothing!

The Solution

Build a small software relay (IPRelay) that will relay any socket connections to your network address to your local host.


GUI Details

The IPRelay has a very simple and minimal GUI that allows changing the IP address and port of the “Listen” and “Forward to” note that the “Listen” address would be your computer external address (or name) and the “Forward to” will point to your web service. The Trace checkbox, when checked, will print all the data coming from the device on the left and all the data sent back on the right. Clear button is used to clear the trace data from both text boxes and the Start button is used to start and stop the routing. Note that all caught exceptions are logged into the right text box.


How Does It Work?

  • The IPRelay listens to incoming socket connections on the “Listen” IP & Port.
  • For every new connection, a new Relay class is created.
  • This class creates a socket connection to the “Forward to” IP & Port then it creates 2 threads that are listening for incoming socket data from both sockets.
  • Whenever data is received by each socket, it is immediately forwarded to the other socket.


March 16 2011First draft


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.190419.4 | Last Updated 16 Mar 2011
Article Copyright 2011 by R%S
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid