net-receive question

For the Compleat Fan
Locked
Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

net-receive question

Post by 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...

Artful code

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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.

Locked