newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Jeff on May 06, 2008, 11:16:26 AM

Title: net-receive question
Post by: Jeff on May 06, 2008, 11:16:26 AM
When using a wait string in net-receive, will it block until it gets that string, even if there are no more bytes available for reading from the socket, or will it complete either when the wait string is encountered or there are no bytes left to read?
Title:
Post by: Lutz on May 06, 2008, 05:36:37 PM
If the wait-string was detected 'net-receive' will return the number of bytes read and the connection will stay open.



Else it will either block waiting until the read-size specified is read or the connection is closed or otherwise interrupted. When the buffer is full or the connection otherwise interrupted 'nil' is returned and the connection is closed, and net-error gives the reason.



The best way to use net-receive with wait-string is, to use 'net-select' and loop/wait for a maximum time.