[futurebasic] Re(3): [FB] TCP Connection State

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

From: Sean -G3- <mclaughlin@...>
Date: Wed, 30 Jun 99 00:18:01 -0400
>>I tried this as well, and it didn't work:
>>      theStatus = FN TCPConnectionStatus%(@gTCPcon)
>>      LONG IF theStatus <> 8
>>        gExchangeStep = _closeTCPconnection
>>      END IF
>>theStatus is always equal to "1", even if I've been connected and active 
>>on a server for five minutes or so.
>The definition of the TCPStatus call in the MacTCP SDK would make it
>appear that you are doing the right thing.
>So you may have to do some digging in the macTCP SDK and figure out how to
>implement an Asynchronous Notification Prodedure so you can be notified of
>a broken connection. 
>- BulkRate: the FirstClass offline reader for Macintosh

I went to the SDK and Inside Macintosh areas for Open Transport and 
MacTCP. Most of the information was not relevant to the use of specific 
functions, but rather, it gave an overview of Open Transport itself.

However, I did find this C example from Inside Macintosh:
<<start example>>

        #include <stropts.h>

        /* check to see if you are already disconnected */

        error = OTIoctl(ep, I_FLUSH, (void*) FLUSHRW);
        if error OTUnbind(ep)

        MyNotifyProc (... void* the Param) {
           case kStreamIoctlEvent        /* flush is complete */
              (void) OTSndDisconnect (ep, NULL);/* safe to disconnect */

        This will result in your notifier receiving all T_MEMORYRELEASED 
events for any outstanding send calls that
        acknowledge sends. You should then attempt to send the 
disconnection request.

<<end example>>

I tried CALL OTIoctl and FN OTIoctl, but FB didn't recognize either of 
them. I'm not even sure that this is the function I need, but it looks 
like it has a chance. Does anyone know how to use this function (or one 
like it) in FutureBasic?

I want to know when I receive an unbind request (and the TCP stream is 
closed), so that I can alert the user that he/she has been disconnected 
from the remote server.

Just finding the toolbox calls would be a good start. Then I'd have to 
find some way to get FB to recognize them, if it doesn't already. That is 
why I wish I knew assembly.