I'm building cross platform app which will be launch on Android at first. I have a problem with socket connection.
I connect via Wifi to my device where is SockedServer. Device not allows internet so my connection via Wifi is without it. And now:
If I have only Wifi adapter enabled, I can connect to socket properly. But when I enable additionally cellular connection I can't connect. I have tried to bind address to Socket like below :
IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName()); IPAddress localAddress = entry.AddressList; //<- my Wifi IPEndPoint localEndPoint = new IPEndPoint(localAddress, portNumber); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); client.Bind(localEndPoint); client.Connect(this.serverAddress, portNumber);
But I still can't connect (method Connect throw timeout). I suppose that the problem is with mobile network (perhaps that, that only this network has internet access)