Port 8080 is used by some other program

Hi, I am using a Raspberry pi given by my friend. I did most of the Octoprint set-up. Now I would like to stream the webcam. Here, I hit a road block. One of my friend's program is using port 8080. He didn't remember how to switch off that program. So, I need to change the port for my webcam stream. I tried to change the hproxy settings, such as the following:

Try1) frontend public
bind *:88
bind 0.0.0.0:443 ssl crt /etc/ssl/snakeoil.pem

Try2) backend webcam
reqrep ^([^\ :])\ /webcam/(.) \1\ /\2
server webcam1 127.0.0.1:8888

I am not successful so far. I rebooted my Pi after every new try. Please help to stream my webcam on to Octoprint. Many thanks in advance.

I'd be more concerned with what's running on port 8080, I for one wouldn't want random servers or services running if I didn't know what they were, might be anything. Flash the SD card with OctoPi and wipe it clean, start fresh.

Chase down the inherited program that's already running on port 8080 and turn it off. Here, I'm looking to see what's running on port 5000.

sudo netstat -lptu|grep ":5000"
tcp        0      0 127.0.0.1:5000          0.0.0.0:*               LISTEN      395/python2 

ps 395
  PID TTY      STAT   TIME COMMAND
  395 ?        Sl     0:11 /home/pi/oprint/bin/python2 /home/pi/oprint/bin/octoprint serve --host=127.0.0.1 --port=5000

cat /etc/init.d/octoprint   # This would be how the service is started at bootup
# consider deleting this file in your case and rebooting (just not "octoprint", obviously)

Thanks for your advice. I will check this asap and kill the program.

Hi, I have tried to follow your instruction of seeing on port 8080, but I didn't get any response. But for port 5000, I got the below response.

pi@EamonnProject:~ $ sudo netstat -lptu|grep ":8080"
pi@EamonnProject:~ $ sudo netstat -lptu|grep ":5000"
tcp        0      0 *:5000                  *:*                     LISTEN      582/python2     
tcp6       0      0 [::]:5000               [::]:*                  LISTEN      582/python2     
pi@EamonnProject:~ $ 

However, I found that the program running at 8080 is codesyscontrol

I stopped it using the following command.

sudo /etc/init.d/codesyscontrol stop

Now, if I do http://127.0.0.1:8080/?action=snapshot on pi, I get a message that I can't access the page.
Same thing is happening with the http://192.168.1.22:8080/?action=stream

Please let me know how to get access to these. Note that I can see the octoprint profile on port 5000.

If it´s not something that was just tested or used earlier.. i would not stop that program. codesys is a PLC like controller that steers Hardware from the PI. If you still have the hardware...it will cease to work properly .
Otherwise remove it´s startup entry from /etc/init.d

Yes, the hardware is not connected now. It was for a different application and that project was over. Now, nothing is shown on port 8080. I want to see video stream from the webcam on this port. Please advice me how can I make it happen through Octoprint.

Now that you've managed to stop codesys, consider archiving out of the /etc/init.d folder that script; move it somewhere under the pi's home directory temporarily if you'd like. You'll probably need to do this with sudo mv /etc/init.d/codesys /home/pi/., for example. In this way, it won't return after a reboot.

Next, go back to your vanilla OctoPi installation with respect to mjpg_streamer's use of 8080.

This appears to be how Guy is running the mjpg_streamer service, for what it's worth. And this then is referred to from /etc/init.d/webcamd. In theory then, try sudo service webcamd start and see if it shows up in ps -ax|grep mjpg_streamer.