Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I realise you're joking, but interested to read more. What drives you crazy about the BSD socket API? Is there another model you've seen or worked with that improves on it?

I've never really considered the socket API in terms of whether it's good or bad - it's just part of reality. But I'm interested to know more.



To be honest, it's been a while since I seriously looked at the alternatives on the lowest level, as BSD sockets basically won - nobody's looking at OpenTransport or TLI anymore.

But I do think they're way too overexposed. It's a very low-level system, with lots of related system calls, ioctls etc., requiring the user to do all the error checking, setup and boilerplate. All error-prone, too many L3 addresses passed around and altogether a mixture of several decades of network programming.

Assuming that's all really necessary on the lower levels (don't want to get into that, not my area of expertise), it's still not something a common systems programmer should face. You might know about the details, just like you know about TCP/IP packets, network layers etc, but more 80+ percent of your day job you shouldn't need to care about that. It's like constructing output piece by piece, with print_number(12); print_string(" / 2 = "); print_number(12/2); print_newline(); etc. Nobody but the most ardent DJB fans would want to do that. But for sockets it's basically expected. Network programming would've needed a printf-style interface from the early days, now it's too late to wrap the basic, the proliferation of incompatible high-perf syscalls didn't help.

I don't want to appear like one of those smug Plan 9 purists, but they did something right. Apart from treating network communication and file systems the same way, they also had some nice wrappers for the lower level stuff, e.g. http://swtch.com/plan9port/man/man3/dial.html

But yes, I'm mainly joking about "bad karma". Getting something right in the first place is hard, and often you don't get second chances.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: