Hello,
I have an app that has been working fine for a couple of years now. Last week I found an issue that ONLY happen (so far) in T Mobile with an S9 phone. The call the TcpClient.Connect is stuck and timeout.
Again this just happen in an S9 from T Mobile with the WIFI off, As soon as I connect the WIFI the issue does not happen.
This is my code:
var tcpc = new TcpClient();
tcpc.Connect( remoteAddress, remotePort);
I have tested both versions of Connect with the address (above) and using the IP:
if (System.Text.RegularExpressions.Regex.Match( remoteAddress , @"\d+\.\d+\.\d+\.\d+").Success) tcpc.Connect(IPAddress.Parse( remoteAddress ), remotePort);
In both cases it fails.
Any idea would be greatly appreciated.
Thanks,
Naura
Answers
@NauraGalarde it could be because Mobile provider does not allow IP Address. Try domain name instead of IP and Port. Mobile providers gradually moving towards IPv6 from IPv4.
This is the entire code. I am using both ways
Follow my working way, maybe this example can help you.
https://github.com/AhsanSiddique/Xamarin-TCP-IP-Server-Client-Sample
Thank you. I actually saw you code a few days a go and base on that I did some changes in my code. But, when I run your code in my phone (S9 + T-Mobile) I have to click on "Connect" button twice and in the second request the connection is established. That's using TcpClient.ConnectAsync. Do you know why?