In a program I just finished I am using strtok to extract TCP messages
one at a time ( with a DELimeter character set to ASCII 10 line feed )..
If you call strtok the first time with a NULL argument
i.e like this strtok ( NULL, (char *) &DEL );
then it returns NULL which suits me fine.... but I'm just curious if
this is the defined behaviour....d
More importantly, in a program that does read()s ( over a TCP
connection ) and which also uses signals I am using code which looks
like
while ( read(...) == -1 )
{ if ( errno != EINTR ) { /* unrecovable error */ }
/* just a signal... try again */
}
( the read call is blocking )
This doesn't work if read() is interrupted while reading .. it will
simply return with the number of bytes it managed to read... What are
the solutions to this rather fundemental problem?
/alex
p.s What is the cause of an IOT / Abort signal?