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 127.0.0.1 IP address and there is no way you can connect from the mobile device emulator to the web service (because the device 127.0.0.21 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.
|
|
History
Date |
Comments |
March 16 2011 |
First draft |