106
µTasker general / cleaning up a socket with no connection
« on: April 17, 2014, 10:50:58 AM »
Hi Mark,
What is the best way to clean up a socket if a connection isnt established? I do the following steps:
1. get a socket fnGetTCP_Socket(..)
2. then call fnTCP_Connect(..) and set a 2 second timer using uTaskerMonoTimer(..)
3. if a connection is established, then stop timer, if not then:
a. fnTCP_close() is called..
b. TCP_EVENT_CLOSED within the callback is processed and fnReleaseTCP_Socket() is called.
Should the fnTCP_close() only be carried out if a connection is made, or simply call fnReleaseTCP_Socket()?
What I am noticing is the next time I am carrying out the above for fnGetTCP_Socket() ucTCP_state = TCP_STATE_ESTABLISHED for the previous fnGetTCP_Socket()
Best Regards
Neil
What is the best way to clean up a socket if a connection isnt established? I do the following steps:
1. get a socket fnGetTCP_Socket(..)
2. then call fnTCP_Connect(..) and set a 2 second timer using uTaskerMonoTimer(..)
3. if a connection is established, then stop timer, if not then:
a. fnTCP_close() is called..
b. TCP_EVENT_CLOSED within the callback is processed and fnReleaseTCP_Socket() is called.
Should the fnTCP_close() only be carried out if a connection is made, or simply call fnReleaseTCP_Socket()?
What I am noticing is the next time I am carrying out the above for fnGetTCP_Socket() ucTCP_state = TCP_STATE_ESTABLISHED for the previous fnGetTCP_Socket()
Best Regards
Neil