socket-write(), pthreads, Solaris5.5 vs. 5.6 -> Fehler

socket-write(), pthreads, Solaris5.5 vs. 5.6 -> Fehler

Post by Norbert Sense » Fri, 19 Mar 1999 04:00:00



Hello,
i have a curious behaviour of a write in a programm:
i write() on a socket und get a negativ return value but errno is 0 !
Can this happen ? I thought errno is always set if an error occured.
When this case happens i have tried to repeat the same write() and
indeed
after about 100 calls of the same write, one returned succesfully and
everything
seems to be fine ! The error occurs nearly every time, when i want to
write
100.000 bytes, but occurs only sometimes if i write only 10 bytes.

This happens only, if i do this write in a second created thread. If i
do
the same write in the original thread, no error occurs !
I'm sure that i do only one socket-access per time since a have saved
all
socket-access's with a mutex-variable.

Finally this error occurs only with Solaris 5.5 ! When i use Solaris 5.6
the problem does not appear any more !

-->
So what's the problem ? Is it an error of the write-implementation ?
Or is it a corret behaviour of the write ?
Can anybody help my?

--
------------------------------------------------------------------
Norbert Sensen            
University of Paderborn       office: F2.411
Dept. of Computer Science     phone: +49 +5251 60-6728

33102 Paderborn               http://www.uni-paderborn.de/cs/sensen
Germany
------------------------------------------------------------------

 
 
 

socket-write(), pthreads, Solaris5.5 vs. 5.6 -> Fehler

Post by Matt Watso » Sat, 20 Mar 1999 04:00:00




> Hello,
> i have a curious behaviour of a write in a programm:
> i write() on a socket und get a negativ return value but errno is 0 !
> Can this happen ? I thought errno is always set if an error occured.

Remember that errno may be defined differently in a multithreaded
environment. Look at errno.h. Are you sure you're defining all the right
compile-time constants (and including errno.h!)?

matt.