On Fri, Jul 11, 2003 at 03:04:18PM -0700, Damon Hastings wrote:

> This is probably a stupid question, but how do you do line-oriented blocking
> socket reads in Pth?  There's a pth_read() which I assume blocks until a
> specified number of bytes (or eof) are received -- but I'm looking for
> something like pth_gets() to block until a newline is received.  I don't
> think you could even write a simple webserver in Pth without such a
> function, though you could of course implement it yourself via a
> non-blocking pth_read in a loop.  I'll implement it myself if need be,
> though I would rather trust someone else's code, as I've never used Pth
> before and there are lots of tricky error conditions in socket programming.
> 
> The documentation at http://www.gnu.org/software/pth/pth-manual.html
> includes a simple output-only server as a code example -- is there an
> input/output example somewhere?

You may want to look at the mmfd.c/h library which is included into
mmftpd and can be found at http://mmondor.gobot.ca/software.html

What it does is custom buffering with the supplied functions, in mmftpd
case it uses pth_read()/pth_write(), that is pretty efficient... It is
released under a BSD-style license. The library comes with an mdoc manual
page.

Matt

______________________________________________________________________
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]

Reply via email to