OliverF / mjpeg-relay

Relays any given MJPEG stream
MIT License
66 stars 23 forks source link

multiple socket relay will cause below problem:Address already in use #9

Open twxia opened 8 years ago

twxia commented 8 years ago

When I want to create multiple socket relay will cause below problem:

python relay.py -w 6003 "http://my-ip/video.cgi" python relay.py -w 6004 "http://my-ip-2/video.cgi"

Traceback (most recent call last):
  File "relay.py", line 66, in <module>
    requestHandler = HTTPRequestHandler(options.port)
  File "/home/twxia/mjpeg-relay/app/httprequesthandler.py", line 24, in __init__
    self.acceptsock.bind(('', port))
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
OliverF commented 8 years ago

Hello,

mjpeg-relay opens two ports: one for Web Sockets and one for standard HTTP clients. By default, the HTTP port is 54321 and the WebSockets port is 54322. You are providing a different WebSocket port by specifying the argument -w 6004, but you also need to provide a different port for the HTTP server, by providing the argument -p <port here>

Try this: python relay.py -p 5003 -w 6003 "http://my-ip/video.cgi" python relay.py -p 5004 -w 6004 "http://my-ip-2/video.cgi"

That should work :)

twxia commented 8 years ago

@OliverF Oh I see :+1: Thanks ~

I think If there are some options can control status page (like basic auth) or can only start one port (like just socket or just http) It'll be great :smile: