cancel
Showing results for 
Search instead for 
Did you mean: 

How to release port 8888.?

Vlaty.1
Senior

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Vlaty.1
Senior

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()

View solution in original post

10 REPLIES 10
alister
Lead

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
Senior

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

Vlaty.1
Senior

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

alister
Lead

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
Senior

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.

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

Vlaty.1
Senior

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()

>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
Senior

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.