[futurebasic] Re: [FB] TCP Connection State

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Greg_Neagle@... (Greg Neagle)
Date: Sun, 27 Jun 1999 11:48:34 -0700
On 6/26/99 at 8:09 PM, mclaughlin@... wrote:

:I am using some TCP routines written by Masaaki Tomura and modified by 
:Greg Neagle. I want to find the state of my TCP stream. For example, if I 
:get kicked off of a server, I want my program to take note of that, and 
:tell the user.
:I tried two methods, both of which did not work. The REMmed out portion 
:is the first method I tried, and the normal portion is the second method.
:      'tempTCPptr& = @gTCPcon
:      'theStatus = tempTCPptr&.myStatus%
:      theStatus = FN TCPConnectionStatus%(@gTCPcon)
:      LONG IF (theStatus = 0) OR (theStatus = 99)
:        gExchangeStep = _closeTCPconnection
:      END IF
:Anyone have a method to find the TCP state? Thanks.

You are finding the TCP state.  theStatus = FN
TCPConnectionStatus%(@gTCPcon) is the correct method.   You are making the
assumption that when you are unexpectedly disconnected from the server
that you'll get a TCPstate of 0 or 99, and I'm not sure that is a valid
assumption.  Once you have established the connection, any state other
than 8 is bad, so you might try checking for that value instead.

- BulkRate: the FirstClass offline reader for Macintosh