简体   繁体   中英

WebSocket-Sharp doesn't respond to public IP address

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: ....

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.

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 ubuntu@yourserver.com

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM