Thursday, May 18, 2006

1. socket(PF_LOCAL,,)
2. set nonblocking IO
int flags = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, (bBlock ? (flags&~O_NDELAY) : (flags | O_NDELAY)));
3. EINTR: a system call can be interrupted when the process caught a signal, usually the system call returned an error and errno was set to EINTR. app should handle the error return explictly.
the typical code sequence would be :
while (systemcall() == -1)
{
if (errno == EINTR)
continue;
//process other errno
}
And we can set the signaction with SA_RESTART flag to allow applications to request that interrupted system call be restarted.
4. writev: write multiple noncontinuous buffers in a single system call. It is more effecient than doing many write calls.

0 Comments:

Post a Comment

<< Home