[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MacTCP timeout
- To: firstname.lastname@example.org
- Subject: Re: MacTCP timeout
- From: joost (Joost Kemink)
- Date: Sun, 18 Aug 91 23:20:49
- Cc: info-mcl
I have only been working with MacTCP from Pascal, and I am not yet a Lisp expert
so some of this might be incorrect. I'll give it a try anyway.
%tcp-passive-open is called with the tcpOpenPB.commandTimeoutValue set to 0
(because the parameter block created in open-tcp-stream is filled with zeroes in
the _NewPtr, Clear trap). Also, the call to the Device Manager that opens the
port is made synchronously (see the #_pbcontrolsync call in %tcp-control), which
means that the OS does not return control to you until an error or timeout
occurs. This explains why you are not able to interrupt the %tcp-passive-open
call, since a tcpOpenPB.commandTimeoutValue of zero indicates an infinite
timeout interval (see MacTCP documentation on TCPPassiveOpen).
As you noticed, you can interrupt the call when you add the code that sets the
commandTimeout value to 2. This causes the synchronous call to return a timeout
error after 2 seconds. The #_pbcontrolsync call in %tcp-control is made inside a
loop that only terminates when the returned error code is unequal to -23016,
(which is the value for the timeout error). So, every time a timeout error
occurs, the synchronous call is made again. This is why you can interrupt the
passive-open call in this situation.
The solution to your problem is to remove the loop, so that the #_pbcontrolsync
call is only made once and always returns the timeout error.
Hope this helps,
Apple Computer, Inc.
Advanced Technology Group