WebSocket-Sharp doesn't respond to public IP address

715 views Asked by At

I have a problem hosting WebSocket-Sharp on a public internet IP. Locally it works fine. This problem occurs on Windows and Linux. I do no receive a timeout or an HTTP status code, the page blocks immediately. I'm 99% sure I have port forwarding set up correctly; I've tried with an Android modem, VPN and regular NAT router setup.

I've tried the following combinations:

192.168.1.2:80 8080 5000 39393

0.0.0.0: ....

public IP: ....

2

There are 2 answers

0
RobotRock On BEST ANSWER

The problem resides in the HttpServer provided with WebsScketSharp. The pure websocket variant (WebSocketServer.cs), instead of the HttpServer option with Get functionality, has an option to set AllowForwardedRequest to true so will be reachable from non localhost addresses. The HttpServer class doesn't support this. It is partially a solution as I gave up regular GET functionality, but thats fine by me.

0
Carles Mateo On

Ok, assuming your server with the public Ip addres is Linux:

  1. Check what ports are listening and what program are listening in those
netstat -tulpn
  1. Check your Firewall rules both in the provider and in the Server
sudo ufw status
  1. See if connections are getting to your Server
sudo tcpdump

You can filter for the port of for origin Ip (if you use a proxy that will be different Ip).

sudo tcpdump | grep "80\|123.45.67.89"

That's the only way to see if the packets are getting into the server.

Let me know if you use Docker as thinks work a bit different.

  1. You can create a tunnel and try like if it was local
ssh -L 80:123.45.67.89:80 [email protected]

Cheers