c++ - Why would connect() give EADDRNOTAVAIL? -
i have in application failure arose not seem reproducible. have tcp socket connection failed , application tried reconnect it. in second call connect() attempting reconnect, got error result errno == eaddrnotavail man page connect() says means: "the specified address not available local machine."
looking @ call connect(), second argument appears address error referring to, understand it, argument tcp socket address of remote host, confused man page referring local machine. address remote tcp socket host not available local machine? if so, why be? had have succeeded calling connect() first time before connection failed , attempted reconnect , got error. arguments connect() same both times.
would error transient 1 which, if had tried calling connect again might have gone away if waited long enough? if not, how should try recover failure?
check link
http://www.toptip.ca/2010/02/linux-eaddrnotavail-address-not.html
edit: yes meant add more had cut there because of emergency
did close socket before attempting reconnect? closing tell system socketpair (ip/port) free.
here additional items at:
- if local port connected given remote ip , port (i.e., there's identical socketpair), you'll receive error (see bug link below).
- binding socket address isn't local 1 produce error. if ip addresses of machine 127.0.0.1 , 1.2.3.4, , you're trying bind 1.2.3.5 going error.
- eaddrnotavail: specified address unavailable on remote machine or address field of name structure zeroes.
link bug similar yours (answer close bottom)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4294599
it seems socket stuck in 1 of tcp internal states , adding delay reconnection might solve problem seem have done in bug report.
Comments
Post a Comment