On Mon, 14 Jul 2003, Damon Hastings wrote: > Yeah, I guess my explanation was a little spotty. :-> What I want is for a > thread to block only until a newline is received on the socket it's reading > from. Suppose the socket receives the 12 bytes "hello world\n". That has a > newline and so I would want pth_readline() to return immediately with the > output "hello world\n". But if pth_readline() does a blocking 1024-byte > read on the socket, it will find only 12 bytes available and will thus > block. Furthermore, the remote host will not send any more bytes because > it's waiting for us to respond, and so pth_readline() will time out, or > never return.
I don't think there's any way in a POSIX/UNIX operating system to block until *all of* 1024 bytes have been read from a file descriptor. The blocking 'read' system call returns as soon as *any* bytes have been read, not putting more than a certain number in the buffer you provide. Under POSIX semantics, you *always* have to do a loop in order to ensure your buffer is filled. So I doubt that pth_read behaves differently. But I haven't looked at the Pth source code in years, so you might want to take a peek to find out if my assumptions are correct. --scott Nazi Rijndael cracking ammunition ASW Ft. Meade nuclear Secretary mail drop postcard United Nations milita assassinate explosives Yeltsin ( http://cscott.net/ ) ______________________________________________________________________ GNU Portable Threads (Pth) http://www.gnu.org/software/pth/ Development Site http://www.ossp.org/pkg/lib/pth/ Distribution Files ftp://ftp.gnu.org/gnu/pth/ Distribution Snapshots ftp://ftp.ossp.org/pkg/lib/pth/ User Support Mailing List [EMAIL PROTECTED] Automated List Manager (Majordomo) [EMAIL PROTECTED]