views:

2951

answers:

7

Want to implement some network capabilities and I wonder what library should one use for cross-platform purposes.

Have only java experience in sockets, so google gave a few tutorials using sys/sockets.h, library sockets++ and boosts asio, which all should be crossplatform capable.

Basically I want to use tcp and ipv4 (maybe ipv6 later on) to send some sensitive documents which will be encrypted with RSA.

What do you suggest? and yes it must be cross-platform.

Edit: Also using qt4 and noticed that it had a network module. How does it compare to the rest ?

+2  A: 

You can trust boost. It is cross-platform, peer reviewed and well-tested.

dirkgently
How cross-platform do you want to be? I've had serious problems with boost when I've had to compile for OSX, Windows, Linux, Solaris, etc. I've worked on projects for GameCube, Xbox, PS2, PS3, XBox 360, Wii, DS, and PSP - though not at the same time. In these cases, regarding boost: run.
I have successfully worked with boost on OSX, Windows, Linux and a few more. Not, any specialized hardware though.
dirkgently
+11  A: 

You can use normal bsd-style sockets. You may have a few #ifdef's going on to detect the OS specific defines, but in general they are the same on all operating systems.

If you'd like to avoid the #ifdefs altogether, you should use boost::asio which was just known as asio and recently included inside boost. Asio was also submitted to the C++ standards committee for possible inclusion in C++ TR2.

Brian R. Bondy
Boost is the way. Trust it.
DaedalusFall
+11  A: 

The best socket library out there using modern c++ is:

However for older style C++ which is probably more familiar to java users, you may like the socket support in trolltech's QT library:

--jdkoftinoff

jdkoftinoff
+5  A: 

I've had success with ADAPTIVE Communication Environment, which consists of platform independant object oriented wrappers for most low level operating system calls (threading, sockets, etc).

ACE is open source and runs on a crazy number of platforms:

The portability of ACE's OS adaptation layer enables it to run on a many operating systems. ACE has been ported and tested on a wide range of OS platforms including Windows (i.e., WinNT 3.5.x, 4.x, 2000, Embedded NT, XP, Win95/98, and WinCE using MSVC++, Borland C++ Builder, and IBM's Visual Age on 32- and 64-bit Intel and Alpha platforms), Mac OS X, most versions of UNIX (e.g., Solaris on SPARC and Intel, SGI IRIX 5.x and 6.x, DG/UX, HP-UX 10.x, and 11.x, Tru64UNIX 3.x and 4.x, AIX 3.x, 4.x, 5.x, DG/UX, UnixWare, SCO, and freely available UNIX implementations, such as Debian Linux 2.x, RedHat Linux 5.2, 6.x, 7.x, 8x, and 9.x, as well as the various Enterprise editions, SUSE Linux 8.1 and 9.2, Timesys Linux, FreeBSD, and NetBSD), real-time operating systems (e.g., LynxOS, VxWorks, ChorusOS, QnX Neutrino, RTEMS, OS9, and PSoS), OpenVMS, MVS OpenEdition, and CRAY UNICOS. A single source tree is used for all these platforms.

17 of 26
A: 

I would suggest to take a look at YAMI - Yet Another Messaging Infrastructure. It is a lightweight messaging and networking framework. Here are YAMI4 video tutorials.

There is also cpp-netlib which aims to get in to Boost C++ Libraries, see post C++ Networking Library Release 0.5

mloskot
+1  A: 

You could use NetLink Sockets C++ library. The easiest to use I have ever tested and also the more logical. You can do everything in a very easy way (you can check out the examples in its website). You should give it a try.

Features (got from the website):

  • Cross Platform (Linux, OSX, Windows Vista/7)
  • Easy to use
  • Powerful
  • Supports both Ip4 and Ip6
  • RPC (Remote Procedure Call) System

Project site:

http://sourceforge.net/projects/netlinksockets/

Examples of use:

http://netlinksockets.sourceforge.net/
Dr. No