I've got a Windows 7 XAMPP setup that I use for quickly testing PHP code. I have been running tests with a PHP WebSocket script I wrote recently, and it works fine on every port I've tested except ports 80 and 443. Neither 80 nor 443 will work with the ws
or wss
protocol. When I try either port, absolutely nothing will go through and the script will just sit there running forever.
The official WebSocket spec (RFC 6455) states:
The WebSocket Protocol attempts to address the goals of existing bidirectional HTTP technologies in the context of the existing HTTP infrastructure; as such, it is designed to work over HTTP ports 80 and 443 ...
And:
By default, the WebSocket Protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over Transport Layer Security (TLS) [RFC2818].
And:
The port component is OPTIONAL; the default for "ws" is port 80, while the default for "wss" is port 443.
So how am I supposed to get ports 80 and 443 to work?
Thanks.
Edit: Here's the first line of netstat
:
I guess that means that I can't use port 80, right?
Typically, this sort of issue would mean one of the following:
To see if it's the first issue, try using netstat
to see what ports you have listeners for:
netstat -a -p TCP -o -n
If it's the second issue, you may have to adjust the way you're running the server so it has the proper permissions.
There may be a workaround (I haven't tried this) to enable port sharing under Windows:
https://msdn.microsoft.com/en-us/library/ms733925(v=vs.110).aspx
...but the behavior may be hard to predict with that sort of setup. Another option is to set up a proxy in IIS (which I assume is what's hogging your port 80).