Websockify error - Address already in use

I'm running a script called quarqd which dumps it's XML data to port 8168. I run this in terminal on OSX Lion. I can connect to the port using netcat and watch the data stream in.

I need to take this data and dump it to a websocket though for manipulation and display in a local only webpage. So I tried doing this with Websockify.

$ websockify 8168 localhost:8169

I run the command and I get a bit of confirming code like it's setting up but then it breaks out with this error message.

[Errno 48] Address already in use

The downer here is that I'm intending for that socket to be in use. It's that data that I want to dump over to the websocket. I've tried multiple port numbers for the second argument just to be sure it wasn't that port being tied up, but still no luck. Isn't Websockify made for this very use? TCP socket to Websocket? If so, how do I get it to run correctly? FYI, I'm a bit new to Python.

Answers


The second address is the target. The first address/port is where you connect using websocket and that's the one that needs to be a free/open port. In other words, you want your addresses reversed:

websockify 8169 localhost:8168

Then tell your browser to connect to host:8169. This will cause websockify to connect to localhost:8168 and bridge the traffic to 8169 which is what the the browser is connected to.

In other words:

browser -> (websockets) -> websockify port 8169 -> (tcp) -> server port localhost:8168

Disclaimer: I made websockify.


Need Your Help

Mobile Safari iOS 9.3 makes multiple HTTP requests, finally showing error

ios css fonts safari font-face

A website which used to work does no longer after the iOS 9.3 update. We get the following error in mobile Safari:

How to Display two alert dialogs in specific order?

android android-dialog

I have two alert dialogs. Whenever app opens, the first dialog is shown. After some time, the second dialog is shown. But here problem is recently created dialog(second one) is in front. But I want...