I am having very strange issue. I have 2 application, one is just my proof of concept, the other one is my real app. Both are Xamarin.Forms applications supporting Android, iOS, and UWP.
Both of these apps use TcpClient to connect to my IP and Port# on another machine. But here is what happens:
How come my POC app can connect, I can ping the host from my Android/IOS device, but I cannot connect from my real app and get this error:
This is how I try to connect
public override async Task<IList<RoomGuestModel>> GetRoomGuestAsync(string roomNumber)
{
using (TcpClient client = new TcpClient())
{
try
{
client.Connect(_tcpConnection.Address, _tcpConnection.Port);
}
catch(Exception ex)
{
}
...
...
// use NetworkStream to write message and read message
await myStream.WriteAsync(...);
...
await myStream.ReadAsync(...);
The problem was that I was using wrong IP address, once I provided correct address, I was able to connect