0

I have a 100 clients that connect to my server using websockets (now tcp). My code is very simple (see below). I have a client on T-Mobile 4G Data using a OnePlus 5t that is not able to connect to the server on mobile data, yet he can on wifi data. Any idea what could be the problem? I must note that I am using .netstandard 2.0 also.

What I have tried so far:

  • User has checked that the app has permission to use mobile data.
  • I have changed the protocol to use 'wss' instead of 'ws'.
  • I have changed the port (user checked https://www.websocket.org/echo.html and it said he was able to connect to it).
  • Finally, (a few weeks later) I have switched everything to a tcp client protocol and this still did not work.

None of these options have thus far worked.

public void Connect(string address, int port)
{
    UriBuilder uriBuild = new UriBuilder("ws", address, port);
    Uri uri = uriBuild.Uri;
    _ws = new ClientWebSocket();
    _tokenSource = new CancellationTokenSource();

    ConnectToServerAsync(uri);
}

private async void ConnectToServerAsync(Uri uri)
{
     await _ws.ConnectAsync(uri, _tokenSource.Token);
}
tval
  • 412
  • 3
  • 17
  • Mobile networks are known to cause problems with persistent connections and interfere with Internet traffic. Due to this some mobile data networks will not allow a WebSocket to connect over WS and port 80. Because of this connections should be made over WSS and port 443. – jazb Nov 09 '18 at 03:37
  • I am using port 2100 – tval Nov 09 '18 at 03:38
  • 1
    so- you may need to configure the client to connect over WSS – jazb Nov 09 '18 at 03:38
  • i though `sftp` usually uses port `22`? – jazb Nov 09 '18 at 03:42
  • This is not a sftp. It uses Tcp protocol. – tval Nov 09 '18 at 03:54
  • oops - sorry ....confused u with another question on sftp...ignore me – jazb Nov 09 '18 at 03:55
  • I changed the uri to "wss", but the client was still not able to hit the server – tval Nov 09 '18 at 04:13
  • What type connection is used to connection mobile to server? If you are using a USB type cable you need a bridge to connection a USB port device to a IP connection. A mobile is using SMS messaging. So most people send email to a mobile using a email to SMS server. – jdweng Nov 09 '18 at 06:09

0 Answers0