Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Sep 1998 14:45:13 +0200
From:      Jean-Francois Dockes <dockes@cdkit.remcomp.fr>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Partial blocking sendto(2) with libc_r
Message-ID:  <3610D659.12230F56@cdkit.remcomp.fr>

next in thread | raw e-mail | index | archive | help
I'm running FreeBSD 2.2.7 release, and trying to add multithreading to
an existing program.

I have a problem with the send/sendto call:  send() sometimes returns an
incomplete count.

The file descriptor is not set as non blocking by my program (of course,
I guess that the underlying threads implementation sets O_NONBLOCK, but
this should be transparent).

The program does not actually create threads right now, it's just linked
with libc_r. When linking with the normal libc, everything works fine.
It also works fine under SOLARIS and LINUX (both with and without the
threads library). The non threaded version of the program has
transferred several terabytes of data to/from FreeBSD servers, so I
guess it's more or less working.

 Also, I checked uthread_sendto.c and uthread_write.c, and they do work
different. write() loops until the byte count is complete, sendto() does
not. 

So my question is: 

 Is it normal that send() could return an incomplete count on a blocking
descriptor ?

The manual page is not clear on the subject. The kernel comments are not
exactly clear either. It seems to me that the normal sosend() will loop
until something bad happens or everything is sent.

Of course my workaround is to use write() except for OOB, but this
doesn't look clean.

---
Jean-Francois Dockes, CDKIT SA          dockes@cdkit.remcomp.fr
Tel: +33 1 41 12 04 44                  Fax: +33 1 41 12 04 47
56 Boulevard de la Republique           92210 SAINT CLOUD. FRANCE

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3610D659.12230F56>