how could an erlang port's port info change to undefined?

517 views Asked by At

I get a erlang server, and many clients use tcp to connect to the server.

After some minutes, use erlang:ports() and erlang:port_info(), I can find some port's port_info is undefined, and the port is closed.I can't find anyway to remove it from ports.

So why did it happen, and how could I remove these undefined port from erlang ports?

1

There are 1 answers

6
Roberto Aloi On BEST ANSWER

The erlang:port_info/1 function returns undefined if the port is not open.

You're calling that function on a port which you didn't open or that has been closed.

Please note that if the Erlang process which created the port (the connected process) terminates, the port will automatically close.