Sometime we require to kill the process at port.
For example.
s=socket.socket()
hostname=socket.gethostname()
port=9494
bind((hostname,port))
...
..
(pressed ctrl+d)
this will cause the process to still run on port 9494. So whenever we try to
bind the same port to another proce then it will give error:
For example.
s=socket.socket()
hostname=socket.gethostname()
port=9494
bind((hostname,port))
...
..
(pressed ctrl+d)
this will cause the process to still run on port 9494. So whenever we try to
bind the same port to another proce then it will give error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use
So, we need to kill the process at that port and it is done by:
$kill -9 `fuser -n tcp 9494`
:) B-)
No comments:
Post a Comment