c++ - "Already Open" error on new connection in Asio -


i'm using non-boost version of asio , have made tcp server based on code @ http://think-async.com/asio/asio-1.11.0/doc/asio/tutorial/tutdaytime3.html

i can establish connection server fine, first time. if disconnect client , attempt connect again, asio passes "already open" error accept handler. can see code, before connection accepted, new instance of tcp_connection class created. i'm not sure why i'm getting error, though it's separate instance socket shouldn't open. appreciated.

thanks in advance.

edit:

here's server class: http://pastebin.com/yvzmfqva

and client class (equivalent tcp_connection class in example): http://pastebin.com/ldhr2nzz

this might because not correctly closing socket upon disconnection. disconnection might happen due exception can't handled (such signal 9), need solution work if process didn't die gracefully...

i bealive can solve it:

socket options so_reuseaddr , so_reuseport, how differ? mean same across major operating systems?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -