2021-09-20 02:24 AM
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.
Solved! Go to Solution.
2021-09-24 06:40 AM
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()
2021-09-20 03:23 AM
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?
2021-09-20 04:15 AM
Yes, this is necessary according to the conditions of the task.
2021-09-20 04:25 AM
Only port 8888 is used to control the scoreboard on Russian railways.
2021-09-20 05:11 PM
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.
2021-09-20 10:22 PM
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.
2021-09-20 10:26 PM
If you can answer the questions of my previous comment, I'll try to help.
2021-09-24 06:40 AM
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()
2021-09-24 05:43 PM
>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?
2021-09-26 10:22 PM
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.