I have a client/server style application which communicates using WCF which all works great. One function of the application is to get files from client machines onto the server (Central Control).
The Central Control requests a list of file in a specified folder on the client and opens up a port using sockets for the clients to connect to and stream each file. It uses a different port number for each file.
This worked fine when testing locally but when deployed to our customers environment I started getting the following exception.
The requested address is not valid in its context
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at System.Net.Sockets.TcpListener.Start()
at AMIGA.Library.TransferFile.listenerThread()
The IP address in the end point is a 10...* address. I googled about for an answer and the general consensus was that with tcpListener cannot bind with an external IP Address. I didn't think a 10...* address was external.
The code that throws the exception is as follows:
tcpListener = New TcpListener(IEndPoint)
Dim handlerSocket As Socket
Dim thdHandler As Thread
tcpListener.Start()
RequestFile()
Is there no way I can use a TcpListener for this Job? What alternatives are there if not and how easy would it be to implement the alternatives.
Bear in mind that we do not have access to the firewall configuration directly, and a change could take a number of weeks to be implemented.