Skip to main content
Vlaty.1
Associate III
September 20, 2021
Solved

How to release port 8888.?

  • September 20, 2021
  • 8 replies
  • 2924 views

I have a problem. My application should use port 8888. I wrote an application in Python 3.5 that uses the address and port 8888 that I need. But Linux issues a diagnosis that port 8888 is already occupied by another task. How to release port 8888.? The Netstat program gives a diagnosis that port 8888 is busy application. Sincerely, Alexander.

This topic has been closed for replies.
Best answer by Vlaty.1

Good afternoon. I have solved the problem with port 8888. In Python, this is solved like this:

HOST, POTR = "192.168.1.20", 8888

home_dir = os.system("ifconfig eth0 add 192.168.1.20:8888")

home_dir = os.system("fuser -k 8888/tcp")

server = socketserver.TCPServer((HOST,PORT), MyTCPHandler)

server.serve_forever()

8 replies

alister
Senior III
September 20, 2021

Guessing you're saying the busy app on the Linux box uses local port 8888. But what you're wanting in your python app is any local port connected to remote port 8888 on your device?

Vlaty.1
Vlaty.1Author
Associate III
September 20, 2021

Yes, this is necessary according to the conditions of the task.

Vlaty.1
Vlaty.1Author
Associate III
September 20, 2021

Only port 8888 is used to control the scoreboard on Russian railways.

alister
Senior III
September 21, 2021

On the Linux box you have your python app.

It needs to connect a scoreboard.

What port does the scoreboard listen on?

Why must the python app use local port 8888? Can't any local port connect the scoreboard?

Perhaps explain your question more carefully.

There are lots of examples. E.g. https://www.geeksforgeeks.org/socket-programming-python.

Vlaty.1
Vlaty.1Author
Associate III
September 21, 2021

Hello. I have a technical task for which I am working. There is already a network tableau of train schedules on Russian railways. They are all managed via port 8888. This cannot be changed. Sincerely, Alexander.

alister
Senior III
September 21, 2021

If you can answer the questions of my previous comment, I'll try to help.

Vlaty.1
Vlaty.1AuthorBest answer
Associate III
September 24, 2021

Good afternoon. I have solved the problem with port 8888. In Python, this is solved like this:

HOST, POTR = "192.168.1.20", 8888

home_dir = os.system("ifconfig eth0 add 192.168.1.20:8888")

home_dir = os.system("fuser -k 8888/tcp")

server = socketserver.TCPServer((HOST,PORT), MyTCPHandler)

server.serve_forever()

alister
Senior III
September 25, 2021

>I have solved the problem with port 8888.

I can see from your answer you are connecting to remote port 8888.

Well done solving that!

What are the two os.system method calls doing, and why are they required please?

Vlaty.1
Vlaty.1Author
Associate III
September 27, 2021

The first command sets the address and port via Linux commands. Second command removes the automatically created task from port 8888. It code made for STM32MP157A.

Vlaty.1
Vlaty.1Author
Associate III
September 27, 2021