I lunched a simulator program which developed on C++ in my Ubuntu 11 when i want kill this process from process list of Linux and want to run it again, i faced to this error:
Error initializing sockets: port=6000. Address already in use
I used lsof command to find PID of process:
saman@jack:~$ lsof -i:6000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME rcssserve 8764 saman 3u IPv4 81762 0t0 UDP *:x11
after that i tried to kill PID of 8764. but still it has error.
How can i fix it?
I think the problem you are having is that the socket if it is not shutdown correctly then it is still reserved and waiting for a timeout to be closed by the kernel.
Try doing a
netstat -nutapand see if there’s a line like this:if that’s the case you just have to wait until the kernel drops it (30 secs approx) until you can open the socket at 6000 without conflict