| I like 0MQ a lot, but this is disingenuous. Let's break it down: > portability Sockets are just as portable, more so on UNIX descendants where one can rely on relatively consistent socket APIs. Beyond that, almost every single language and runtime (Python, Ruby, Java, OCaml ...) provides a portable socket API. > message framing Length-prefixed message framing winds up being 10-100 lines of code in almost any language/environment. > super fast asynchronous I/O Sockets have this. > queuing Sockets have buffers. The OS can use those buffers to implement flow control. This isn't the same as queueing, but the truth is that you rarely want blind background queueing of an indefinite number of messages that may or may not be delivered. > support for every bloody language anyone cares about Just like sockets. > huge community I don't think you can get 'huger' than the community around sockets. > price tag of zero Seeing as socket libraries ship with everything, does that mean they have a time/resource cost of less than zero? > mind-blowing performance Also, sockets. > protection from memory overflows This has essentially nothing to do with a networking library. Plenty of environments have safe/efficient zero-copy chained byte buffer implementations/libraries. > loads of internal consistency checks Library correctness isn't a unique feature. > patterns like pub/sub and request/reply, batching Ah-ha! Here finally we get to the meat of it! If you need QUEUES, including pub-sub, fanout, or any other QUEUE-based messaging structure, than 0MQ is better than sockets! > and seamless support for inter-thread transport as well as TCP and multicast Inter-thread transport of already-serialized messages at the transport protocol layer doesn't make a ton of sense from an efficiency perspective. > ZEROMQ IS JUST SOCKETS No, 0MQ is a lightweight network message queue protocol. It's not competing with sockets. |
You've got to be kidding me. The BSD socket API is only "portable" for basic things. Do any kind of advanced thing and you will notice the limitations of the "portability".
Want to write an evented server that handles a large number of sockets? Choose your favorite platform-specific API: epoll, kqueue, whatever Solaris is using, etc.
Error handling? Each platform behaves in a subtly different manner. See http://stackoverflow.com/questions/2974021/what-does-econnre... for an example.
Windows support? I hope you don't mind the #ifdefs and typedefs in code. The WinSock API is still OKish... it doesn't differ from the basic BSD socket API too much. But good luck trying to handle more than 1024 sockets in a non-blocking/async manner. I hope select() on Windows serves you well.
> Length-prefixed message framing winds up being 10-100 lines of code in almost any language/environment.
Only if you're writing blocking code. If your code is evented, good luck with writing 2-3 times more code. Oh, and don't you dare getting that code wrong and introduce bugs. And of course you have to write this code every single time. And you didn't forget to unit test all that, did you?