* Alexander Farber <[EMAIL PROTECTED]> [2005-08-11 17:11]: > Hi, yet another "smart" question: if I call bind() this way > > struct sockaddr_in sin; > int fd; > > fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); > bind(fd, (struct sockaddr*) &sin, sizeof(sin); > ... > > then do I still have to use sockaddr_storage in an accept() call later > or will sizeof(sin) from above (or PF_INET?) get saved somewhere > and thus using sockaddr_in is safe enough?
sockaddr_in would suffice, but it is bad style. with sockaddr_storage, you ar eon the safe side, even when you add v6 support later, or v8, or whatever the future brings, so play safe and use sockaddr_storage, that's what it is for. > BTW neither write(2) nor accept(2) mention EINTR even though > that value appears in /usr/src/lib/libpthread/uthread/uthread_*.c > (I used a sendbug to report it this morning, but didn't get a reply). basically every system call can be interrupted and thus fail with EINTR -- BS Web Services, http://www.bsws.de/ OpenBSD-based Webhosting, Mail Services, Managed Servers, ... Unix is very simple, but it takes a genius to understand the simplicity. (Dennis Ritchie)

