Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Remoting over VPN

We have an app using a tcp SAO over a LAN. All working quite happily.
Recently tried it over an ADSL VPN supposing this would be quite transparent. The call to the SAO passes in a Stream parameter. The problem is that the calls just hang for a while and then timeout with a Remoting exception. In the debugger the calls duly arrive at the server, but as soon
as the server code attempts to do anything with the Stream parameter it just hangs. Presumably the server is unable to find a channel back to the client to access the Stream, but how does a VPN affect this? The VPN appears to be working correctly out of this context, including a 'normal' sockets utility program we use and normal windows browsing. Does anybody know what is going
on here?

Stacey Richards
Tuesday, July 22, 2003

I've noticed on some occassions when doing VPN type stuff, the remote side tries to make a connection back to my system on a different port, and the filters are obstructing this.

Let me know if you got it working, I'm interested in knowing HOW

Mark W.
Saturday, August 16, 2003

Not long after I posted the original message, I found what was going wrong. When connected to the VPN I have two IP address, one being my loacal area network IP address, and the other begin the VPN IP address. I found that when the TcpChannel was making the connection to the server, it was  passing the IP address of my local area network, not the VPN, to the server as the callback address. I needed to tell the TcpChannel to use the IP address of the VPN. Once I did this, all was well. The following code may help:

            IDictionary dctFormatterProperties = new Hashtable();
            dctFormatterProperties["typeFilterLevel"] = "Full";
            BinaryServerFormatterSinkProvider bsfsp =
              new BinaryServerFormatterSinkProvider(dctFormatterProperties, null);
            IDictionary dctChannelProperties = new Hashtable();
            dctChannelProperties["port"] = [the port that you want to connect to the server on];
            dctChannelProperties["machineName"] = [your VPN IP address];
            m_chan = new TcpChannel(dctChannelProperties, null, bsfsp);

Be aware: 'typeFilterLevel", "port", and "machineName" are case sensitive!

Sunday, August 17, 2003

*  Recent Topics

*  Fog Creek Home