Forum General

Websocket cannot connect when using mobile data

tvaltval Member ✭✭

I have a hundred or so clients connected to my server using .NetStandard websockets. Yet, I have one client on 4g data using an Android OnePlus 5t (T-Mobile data) that cannot connect. My server never even receives a call to begin the connection. Note, that he can connect using wifi data. Below are the things I have tried. Has anyone had a similar issue or know what could be the problem and how it might be solved. This is a TCP connection over port 1334.

  • User has checked that the app has permission to use mobile data.
  • I have changed the protocol to use 'wss' instead of 'ws'.
  • The user can connect to the server through the following website:


  • chungmclchungmcl Member ✭✭

    I have this same issue with the OnePlus 6T. Both the stock and T-Mobile versions cannot seem to utilize .NET TcpClients or websockets on data, yet all other Android devices I've tested work. What's odd is that it functions on WiFi but not cellular data.

  • tvaltval Member ✭✭

    I still haven't been able to solve this. The only other thing I can think of is that TMobile is blocking my IP because it is IPv4 and not IPv6. But I cannot test this since my internet provider does not provide it here yet.

  • chungmclchungmcl Member ✭✭

    I've tried the same thing with a Google Pixel and a Samsung Tablet on T-Mobile and have had no issues. I tried contacting OnePlus for help but they've been reluctant to offer any genuine support. It must be OnePlus because I've had literally no issues with any other devices on the same and different networks.

  • chungmclchungmcl Member ✭✭

    If you could upvote my bug report on OnePlus' bug report website and perhaps submit your own bug report to OnePlus, I'm sure we could raise the attention of this issue. I can't post comments with links because I'm still new to Xamarin Forums (pun not intended), but if you visit OnePlus' feedback website at "forms 'dot' oneplus 'dot' com 'slash' feedback" and search for the bug titled "TCP data failing to send on mobile data", you should be able to find mine.

  • tvaltval Member ✭✭

    But this same user can connect to other servers using the TCP protocol. That's what I don't understand. It just my server he cannot connect to.

  • chungmclchungmcl Member ✭✭

    Yes, it's insanely confusing. After a lot of debugging and rewriting, I've gotten it to work on data now, but if I switch to Wi-Fi and back to data, it fails again. I'm so frustrated and confused about what's happening. I seriously cannot tell what is wrong. This issue occurs on none of the other Android devices I've tested.

  • tvaltval Member ✭✭

    Can you share the piece of code that you used to make it work with mobile data, please.

  • IrongutIrongut Member ✭✭✭
    edited February 2019

    @tval said:
    This is a TCP connection over port 1334.

    That is an unusual port number, it is quite common for mobile operators to block unusual ports in order to prevent the spread of malware.

    The user can connect to the server through the following website:

    That is using port 80 (or 443 if https) which is obviously a standard port and not blocked by any mobile operator or their customers couldn't access any websites.

    My suggestion would be to try using a common port like 80 or 8080 for your traffic. I never have any problems using those ports on mobile data.

  • tvaltval Member ✭✭
    edited February 2019

    This is a mobile game, not and email or http app. It uses one port to connect to the server and other ports to chat or other stuff. So using a single port 80 or port 443 is not going to work. But I now have 1500 some users on mobile data that can handle these ports. Also, I have tried switching ports to no avail. Like I say, so far it is just this one user that I am aware of that cannot connect to the server. I've debugged it through, and the server never receives a packet to begin the connection process.

Sign In or Register to comment.