tags:

views:

118

answers:

3

Are there any c++ networking libs that are very useful and robust? and libs to help them be run better? something like automatically endian conversion when using <<, blocking reads until the struct or w/e your reading completely transfers, something to help debug your protocol, etc

+3  A: 

Have you had a look at Boost.Asio? It's a networking library supporting both asynchronous and synchronous operation. I've made some experiments with it in the past, and found it quite useful.

Johannes Schaub - litb
A: 

I'd recommend sockets... its quite easy to make cross-platform code for Win32/*nix if you use it, although it is quite low level it does provide blocking functionality (i.e. halts execution until message is recieved). There are a ton of tutorials for sockets programming available... just google for "sockets" or "WinSock" (the Win32 flavour).

http://www.google.co.uk/search?q=sockets+programming

It won't deal with endian-ness for you, but there are a number of simple ways around this problem, like using a signature byte/word (e.g. 0xC1 (11000001b), 0x00C1) at the start of a message to determine the endian-ness.

jheriko
You can use the host-to-network and network-to-host functions in winsock to convert between local and network byte order. e.g htonl() = host to network long.
Ferruccio
+1  A: 

I like the ADAPTIVE Communication Environment. It has built in constructs for just about all the networking patterns. I particullarly like ACE_Task. It makes message passing SO much easier.

Jere.Jones
My biggest complaint with ACE (when I messed with it several years ago) was that it had more of a C feel than a C++ feel, which may be linked to the fact that it was, IIRC, started before the first ISO standard came out.
Harper Shelby