Port already in use?



  • Hello,
    I’m trying to set up Monocle Gateway, but Alexa can’t show my cameras.
    I think the port 443 is already in use on my machine by node-red.
    How to solve the issue?
    Thanks

    Jul 31 21:39:43 homeserver systemd[1]: Started Monocle Gateway Service.
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  ******************************************************************
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  *             __  __  ___  _  _  ___   ___ _    ___              *
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  *            |  \/  |/ _ \| \| |/ _ \ / __| |  | __|             *
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  *            | |\/| | (_) | .` | (_) | (__| |__| _|              *
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  *            |_|  |_|\___/|_|\_|\___/ \___|____|___|             *
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  *                                                                *
    Jul 31 21:39:43 homeserver monocle-gateway[18842]:  ******************************************************************
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: -------------------------------------------------
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: MONOCLE RUNTIME ENVIRONMENT
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: -------------------------------------------------
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: VERSION   = 0.0.4
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: OS/ARCH   = linux/x64
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: PROCESS   = monocle-gateway (PID=18842)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: TIMESTAMP = 2019-07-31T19:39:44.384Z
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: -------------------------------------------------
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: MONOCLE GATEWAY SERVICE         (Version: 0.0.4)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: -------------------------------------------------
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Starting]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Connecting]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Started]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Starting]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Listening] 0.0.0.0:8555 (RTSP)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Listening] 0.0.0.0:443 (RTSP-TLS)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Proxy Started] (PID=18861)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Listening] 0.0.0.0:8554 (PROXY)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Started]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: 2019-07-31T19:39:44.507Z [ERROR] [PROXY SERVER ERROR] Error: listen EADDRINUSE 0.0.0.0:443
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [ '[PROXY SERVER ERROR]',
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:   { Error: listen EADDRINUSE 0.0.0.0:443
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at Object._errnoException (util.js:1031:13)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at _exceptionWithHostPort (util.js:1052:20)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at Server.setupListenHandle [as _listen2] (net.js:1367:14)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at listenInCluster (net.js:1408:12)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at doListen (net.js:1523:7)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at _combinedTickCallback (internal/process/next_tick.js:141:11)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at process._tickCallback (internal/process/next_tick.js:180:9)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at Function.Module.runMain (pkg/prelude/bootstrap.js:1299:13)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at startup (bootstrap_node.js:227:16)
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     at bootstrap_node.js:649:3
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     errno: 'EADDRINUSE',
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     code: 'EADDRINUSE',
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     syscall: 'listen',
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     address: '0.0.0.0',
    Jul 31 21:39:44 homeserver monocle-gateway[18842]:     port: 443 } ]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: 2019-07-31T19:39:44.526Z [ERROR] [RTSP Server Error] listen EADDRINUSE 0.0.0.0:443
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [ '[RTSP Server Error]', 'listen EADDRINUSE 0.0.0.0:443' ]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Connected]
    Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Registered]
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: -------------------------------------------------
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: MONOCLE RTSP SERVICE - INITIALIZED
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: -------------------------------------------------
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: FQDN = a49b87ea-d059-44c5-900f-7a3b4123a9e1.mproxy.io
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: HOST = 192.168.178.10
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: PORT = 443
    Jul 31 21:39:45 homeserver monocle-gateway[18842]: -------------------------------------------------
    


  • @jannnfe

    You can check to see what processes are already using port 443 using the following command:
    (ref: https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/)

    $ sudo lsof -i -P -n | grep LISTEN
    
    uv4l       334    root    4u  IPv4  13349      0t0  TCP *:8080 (LISTEN)
    sshd       463    root    3u  IPv4  11156      0t0  TCP *:22 (LISTEN)
    sshd       463    root    4u  IPv6  11158      0t0  TCP *:22 (LISTEN)
    monocle-g  759 monocle   13u  IPv4 489943      0t0  TCP *:8555 (LISTEN)
    monocle-g  759 monocle   15u  IPv4 489944      0t0  TCP *:443 (LISTEN)
    monocle-p  774 monocle    3u  IPv4 495953      0t0  TCP *:8554 (LISTEN)
    

    If something else is already using port 443, you will need to change that application to use an alternate port.

    Monocle Gateway requires port 443 because Alexa device will only connect to stream on port 443. (and we need Alexa to connect to the gateway.)

    Other options would be to move the gateway to another server. Add an additional IP interface (or simply assign a secondary IP) so that Monocle get’s its own dedicated network/IP to listen on and the other app can remain on the existing. Docker containers, Virtual servers, etc. All these options of course require a little more advanced setup and networking knowledge to make sure you get it all configured correctly.

    Let us know how it goes and which path you are going to try.

    Thanks, Robert



  • Hey Robert,
    thanks for your reply. In fact, another service was active at 443. I stopped it and the error message above does not come anymore. Unfortunately, Alexa still can not see my camera. I do not know where to look, why the camera does not work.

    I would like to move the gateway to a Docker container, which gets its own IP address on my server. Is there somewhere a guide? I think that will also interest many other people.

    Thanks! 🙂



  • @jannnfe

    For Docker images of Monocle Gateway, please see:

    These are based on Alpine images. Pay close attention to the networking notes, the networking mode is very important for the Monocle Gateway.

    Honestly, I would try to get it working first before going the Docker route. Once you have your cameras at least working, then you can move it into a Docker container.

    Any log data from the now listening Monocle Gateway as you ask Alexa for a camera stream?

    Thanks, Robert



  • This is the tail, when I ask my Echo Show 5 for the camera:

    Aug 05 18:55:31 homeserver systemd[1]: Started Monocle Gateway Service.
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  ******************************************************************
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  *             __  __  ___  _  _  ___   ___ _    ___              *
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  *            |  \/  |/ _ \| \| |/ _ \ / __| |  | __|             *
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  *            | |\/| | (_) | .` | (_) | (__| |__| _|              *
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  *            |_|  |_|\___/|_|\_|\___/ \___|____|___|             *
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  *                                                                *
    Aug 05 18:55:31 homeserver monocle-gateway[29981]:  ******************************************************************
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: MONOCLE RUNTIME ENVIRONMENT
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: VERSION   = 0.0.4
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: OS/ARCH   = linux/x64
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: PROCESS   = monocle-gateway (PID=29981)
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: TIMESTAMP = 2019-08-05T16:55:32.039Z
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: MONOCLE GATEWAY SERVICE         (Version: 0.0.4)
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Starting]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Connecting]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Started]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Starting]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Listening] 0.0.0.0:8555 (RTSP)
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Listening] 0.0.0.0:443 (RTSP-TLS)
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Proxy Started] (PID=29993)
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Listening] 0.0.0.0:8554 (PROXY)
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Started]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Connected]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Registered]
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: MONOCLE RTSP SERVICE - INITIALIZED
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: FQDN = a49b87ea-d059-44c5-900f-7a3b4123a9e1.mproxy.io
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: HOST = 192.168.178.10
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: PORT = 443
    Aug 05 18:55:32 homeserver monocle-gateway[29981]: -------------------------------------------------
    
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: INITIALIZE RTSP STREAM:  Kamera Eingang
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - NAME  : Kamera Eingang
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - LABEL : PRIMARY
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - URL   : rtsp://192.168.178.19:554/11
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - UUID  : STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - SESS  : c22d9df3-d3e5-4349-929c-47ce4468df52
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - MODIF : Mon Aug 05 2019 18:53:00 GMT+0200 (CEST)
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:  - TAGS  : @noaudio,@proxy-tcp
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.588Z [INFO]  [RTSP PROXY] REGISTERING STREAM [Kamera Eingang/PRIMARY]; (STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6)
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.600Z [DEBUG] <RTSP-PROXY> [REQUEST]  --> [REGISTER] rtsp://192.168.178.19:554/11
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.600Z [TRACE] <RTSP-PROXY> [REQUEST]  --> [HEADERS] {
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:   "cseq": "1",
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:   "transport": "reuse_connection=0;preferred_delivery_protocol=interleaved;proxy_url_suffix=STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6;username=admin;password=hailer05"
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: }
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.601Z [DEBUG] <RTSP-PROXY> [RESPONSE] <-- [200 (OK)] <cseq=1> (session=undefined)
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.601Z [TRACE] <RTSP-PROXY> [RESPONSE] <-- [HEADERS] {
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:   "cseq": "1",
    Aug 05 18:55:54 homeserver monocle-gateway[29981]:   "date": "Mon, Aug 05 2019 16:55:54 GMT"
    Aug 05 18:55:54 homeserver monocle-gateway[29981]: }
    
    Aug 05 18:55:56 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:56 homeserver monocle-gateway[29981]: INITIALIZE RTSP STREAM:  Kamera Eingang
    Aug 05 18:55:56 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - NAME  : Kamera Eingang
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - LABEL : PRIMARY
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - URL   : rtsp://192.168.178.19:554/11
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - UUID  : STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - SESS  : bae6ded6-dd6b-4c1c-bfc8-a03d5322a053
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - MODIF : Mon Aug 05 2019 18:53:00 GMT+0200 (CEST)
    Aug 05 18:55:56 homeserver monocle-gateway[29981]:  - TAGS  : @noaudio,@proxy-tcp
    Aug 05 18:55:56 homeserver monocle-gateway[29981]: -------------------------------------------------
    
    Aug 05 18:55:57 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:57 homeserver monocle-gateway[29981]: INITIALIZE RTSP STREAM:  Kamera Eingang
    Aug 05 18:55:57 homeserver monocle-gateway[29981]: -------------------------------------------------
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - NAME  : Kamera Eingang
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - LABEL : PRIMARY
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - URL   : rtsp://192.168.178.19:554/11
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - UUID  : STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - SESS  : d2ea0e9c-f5f5-4da9-a283-32068052ab5a
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - MODIF : Mon Aug 05 2019 18:53:00 GMT+0200 (CEST)
    Aug 05 18:55:57 homeserver monocle-gateway[29981]:  - TAGS  : @noaudio,@proxy-tcp
    Aug 05 18:55:57 homeserver monocle-gateway[29981]: -------------------------------------------------
    

    These are my settings in the gateway:
    Bild Text

    I use Zoneminder on my network to stream my cameras. With the settings here, the image works fine in Zoneminder and VLC. What am I doing wrong?
    Bild Text
    Bild Text

    Thanks!



  • @jannnfe

    Are you using a Fritzbox on your network?
    If so, search the forums for “Fritzbox” and/or “DNS Rebinding” these routers must have some additional configuration to permit the DNS hostname resolution for the Monocle Gateway.

    If you log, I can see that the camera’s are tagged correctly and we are getting the request from Alexa and notifying your Monocle Gateway instance. What’s missing is the Alexa device making a TCP connection to the gateway to start the stream.

    Thanks, Robert


Log in to reply