문제

I have a program (Python) that in some point uses

    zmq.Context.socket(zmq.REP)

and

    zmq.Context.socket(zmq.PAIR) 

sockets but the problem is that when program is killed the sockets still can be found using:

    'ps aux | grep zmq'

command. So what can I do to make them disappear after program is killed?

도움이 되었습니까?

해결책

According to;

https://superuser.com/questions/127863/manually-closing-a-port-from-commandline

Only an application can close the sockets it is using, after the applications process is killed, the sockets should be automatically freed within a couple of minutes. Are you being patient enough?

다른 팁

You can use SO_REUSEADDR to work around that problem

SO_REUSEADDR Indicates that the rules used in validating addresses supplied in a bind(2) call should allow reuse of local addresses. For AF_INET sockets this means that a socket may bind except when there is an active listening socket bound to the address. When the listen- ing socket is bound to INADDR_ANY with a specific port then it is not possible to bind to this port for any local address. Argument is an integer boolean flag.

This should anser most of your questions http://hea-www.harvard.edu/~fine/Tech/addrinuse.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top