net-receive question

Started by Jeff, May 06, 2008, 11:16:26 AM

Previous topic - Next topic

Jeff

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?
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code

Lutz

#1
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.