0

I should listen (I don't know) on a certain port, in this case the 8080, to understand why it closes and if so with what error.

I have a nodejs server running on the 8080, but I can't figure out why it shuts down.

Is there any command that allows me to do this?

Background Info:

I created a simple server in node.js, for testing. The application I'm developing is an extension of raycast.

This extension, by specifying the directory where the server is located, reads the package, shows the commands inside and through a menu bar on MacOS, shows the executable commands. By clicking on a command the user will execute it, for example start the server in node.js.

The problem is when there are console.logs inside the server.

If there is no console.log, there is no problem, but if one is run the server stops working, but it only stops working when started by the extension, if it starts normally there is no problem.

I would like to understand what happens.

If there's anything I wasn't clear on let me know.

3
  • your nodejs code ? try to catch and print error code from listening primitive. did you unwilligly listen multiple time to same port+IP ? did you exit whole program instead of a single thread ? If your are not responsible for that code, and it is part of bigger application, recheck installation and start procedure, 8080 is pretty common for http, did another java/tomcat whatever is also running ?
    – Archemar
    Commented Nov 10, 2023 at 20:09
  • Paul, please don't add explanations in the comments. Instead, add it to your question so it's really easily visible for everyone. Commented Nov 11, 2023 at 8:31
  • And now delete your duplicate comments please. Just spent time reading them, thinking there was something new to understand /-;! Good luck.
    – shellter
    Commented Nov 12, 2023 at 17:12

1 Answer 1

1

Based on the tags of the question, you are using bash on a mac. The best way to see what is happening on a port is tcpdump.

Based on the port 8080 being used, I am assuming it is standard http traffic, not https. Therefore you can print the packets as ASCII to get an idea of what is being sent/received by the application layer. Run the below command as sudo, or as root. The -A at the end will print to the console any part of the packet that contains an ascii character.

tcpdump -i any port 8080 -A  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .