Q: I'd like my network client software to be able to abort an asynchronous
OTConnect in progress -- to allow a user, for example, to recover from an
attempted connection to a nonexistent IP address.
I've been calling OTSndDisconnect to abort it, but when I check the return
code, I get a kOTOutStateErr . What gives?
A: Using a OTSndDisconnect is the proper way to abort an OTConnect in progress.
After successfully calling OTConnect , the endpoint state will transition from
T_IDLE to T_OUTCON . Calling SndDisconnect returns the endpoint state to T_IDLE . You may be getting a kOTOutStateErr for the following reasons:
- The original
OTConnect failed. Determine this by checking the OTConnect
result.
- The connection broke and was asynchronously handled by your notifier. In
this case, your endpoint would no longer be in the
T_OUTCON state when you do
the disconnect.
A good rule of thumb is to always confirm the endpoint state before doing the
OTSndDisconnect to insure that the endpoint isn't already disconnected.
|