4

What libraries are the best (in terms of performance) for network programming in C on windows and UNIX?

I'm quite interested with respect to high frequency trading.

I have heard about BSD and POSIX but I wasnt sure if there were faster performance-specific libraries?

user997112
  • 29,025
  • 43
  • 182
  • 361
  • 1
    What are your requirements? Have you demonstrated that the OS-provided networking facilities do not meet those requirements? – Greg Hewgill Oct 24 '11 at 01:22
  • 1
    The OS-provided networking is quite capable of saturating a gigabit ethernet connection. How fast is your connection to the internet? – Paul Tomblin Oct 24 '11 at 01:29
  • 1
    What do you mean by OS-provided networking facilities? I wish to write some server-client demo programs in C and it was my understanding the original C standard contains no networking libraries, so I would have to use something else (like bsd, POSIX etc), atleast in the case of Windows? Im unsure about UNIX – user997112 Oct 24 '11 at 02:02
  • 1
    The C Standard provides no networking libraries - 'tis true. But if you're working on a Unix-like platform, the 'standard' (as in 'provided by the OS') libraries will include BSD sockets, and those will perform well for you. On Windows, there's probably a wholly different interface (WinSock?). Or you can use Cygwin or Mingw to provide BSD sockets. They're all likely to perform well enough too. – Jonathan Leffler Oct 24 '11 at 06:00
  • @Jonathan WinSock is derived from BSD, so they are similiar. – glglgl Oct 24 '11 at 06:03
  • possible duplicate of [link](http://stackoverflow.com/questions/118945/best-c-c-network-library) – cyber_raj Oct 24 '11 at 06:59
  • It depends a lot of what you need to do besides networking. Give some more details and people will start to advocate their favorite thread or non-thread library. – Prof. Falken Oct 24 '11 at 07:10

2 Answers2

6

The fastest way would be to use the OS's networking functions: socket(), setsockopt(), connect(), listen(), send(), recv() etc. etc.

There are subtle differences between them on several OS's.

To cope with this, there are wrappers around them in several libraries, e.g. in Qt (at least, IIRC). I don't think anything will noticeably slow down if you use them...

glglgl
  • 89,107
  • 13
  • 149
  • 217
0

What about ZeroMQ. [http://www.zeromq.org/][1]

It's a faster, easy to code and also can be used as Message Queue.

Pritesh Acharya
  • 1,596
  • 5
  • 15
  • 36