View Full Version : Good, free, open-source, thread-safe, cross-platform, c++ network programming lib?
Slougi
September 17th, 2004, 15:28
Well are there any?
Hacktarux
September 17th, 2004, 15:52
I have no idea what you're trying to do and i know it's not c++ but..... do u have considered using java ? This language is really great to build little cross-platform network tools...
Otherwise, i don't know if there are any generic c++ libs... but depending on what you're trying to do maybe you can find a specilized lib.
Do u have looked at QT ? it's not very convenient imo but it contains network stuffs.
SDL is another possibility.
Cyberman
September 17th, 2004, 16:11
Well are there any?
Slougi... what TYPE of networking? Are you refering to TCP/IP IPV4 or IPV6?
Are you refering to support for services such as HTTP FTP (TCP UDP passive mode transfer?) SNMP NNTP raw TCP connection?
As a friend once said 'If you haven't qualified and quantified it. Then you don't know what you are getting into' :)
Also about thread safe, not all platforms support threading. Just to warn you. ;)
This reminds me I need to work on my NNTP support for something (DOH!)
Cyb
zenogais
September 18th, 2004, 17:31
Here's a few I picked up just by googling your qualifiers:
OpenTNL (http://www.opentnl.org/)
HawkNL (http://www.hawksoft.com/hawknl/)
SDL_Net (http://www.libsdl.org/projects/SDL_net/)
BTW I have yet to see an open-source project that isn't also free :P
Slougi
September 22nd, 2004, 08:19
Slougi... what TYPE of networking? Are you refering to TCP/IP IPV4 or IPV6?
Are you refering to support for services such as HTTP FTP (TCP UDP passive mode transfer?) SNMP NNTP raw TCP connection?
Darn I knew I forgot something! :P
Specifically TCP/IP IPV4, I don't need socket level stuff; basically what I want is "Listen on port 5678 and give me a way of writing and reading from there ktnx." I don't want to worry about socket(), bind(), connect(), listen(), accept(), select(), struct sockaddr. Or about winsock. It would be cool if it abstracted all that with nice exception handling.
As for threads, yes I know they are not available everywhere. ;)
As for portability, I actually just realized that it really only needs to run on *nix, Linux and the BSDs would be cool.
As you might have noticed I am not too good with network stuff ;) Basically I think it's the most boring aspect of computing in general, and whenever I go to learn how to really do any network stuff I find myself doing something different altogether.
Hack: Java is not really an option I'm afraid; nor QT. Actually SDL is not either :P
zenogais: I'd googled already but not really found anything... HawkNL looks cool, I think I'm gonna go for that. It's C, not C++, but that's ok. Thanks!
P.S. open-source software doesn't have to be free in the gnu sense; look it up ;)
Doomulation
September 22nd, 2004, 08:40
Basically as I remember when doing a network proggie, it's veyy easy... first you get the ip of the target computer. Set the target computer to listen for incoming connections. Connect to the computer. Target computer should accept the incoming call. Now you're all set to send stuff across the network...
This was the prodecure with MFC, though I hope it isn't that much more complicated without MFC and a non-window OS. Good luck ;)
Hacktarux
September 22nd, 2004, 11:59
Slougi, actually, if you only have to do simple stuffs like that, maybe you don't need any lib, here's the way i use sockets for simple things : copy the exemple given in the info page of the libc, and fill it with your code, it'll work, you don't even have to try understanding how the socket works :P
Slougi
September 22nd, 2004, 12:43
Look people I know how it all works - I even got Stephen's book on unix network programming ;)
The problem was originally that I didn't want to add a few zillion #ifdefs for winsock; especially considering that I have no idea how winsock differs from berkeley sockets.
zenogais
September 22nd, 2004, 14:46
Slougi:
I was just stating a fact, never said that GNUed projects can't be free.
Anyway in general I would say Windows, specifically Winsock, really makes sockets more difficult than they have to be. I find the Berkley sockets library to be much more usable than winsock. Anyway, good luck Slougi, is this an up and coming project by any chance, or just something private?
Cyberman
September 22nd, 2004, 18:04
Look people I know how it all works - I even got Stephen's book on unix network programming ;)
The problem was originally that I didn't want to add a few zillion #ifdefs for winsock; especially considering that I have no idea how winsock differs from berkeley sockets.
Well.. Slougi under *nix if I remember correctly you don't even need to write a program for this. You just need to tell the OS what the daemon service is and what program to call to handle it. Now at THAT point you might need to use a program. It could be a script that merely adds to a counter though. You might need to specify UDP or TCP though for the method to OS.
Under unix you can't just run a program to monitor a port, you have to configure the system to allow that :D
Cyb
zenogais
September 23rd, 2004, 01:29
Quick question, why not write your own wrapper, for the functionality you're requesting its probably not too hard to create a solid wrapper for these functions in < 45 minutes.
Slougi
September 28th, 2004, 09:00
Well.. Slougi under *nix if I remember correctly you don't even need to write a program for this. You just need to tell the OS what the daemon service is and what program to call to handle it. Now at THAT point you might need to use a program. It could be a script that merely adds to a counter though. You might need to specify UDP or TCP though for the method to OS.
Under unix you can't just run a program to monitor a port, you have to configure the system to allow that :D
Cyb
You're probably talking about inetd/xinetd, which works somewhat that way. It listens on all ports specified to it and launches the appropriate daemon - I don't know the exact calling semantics etc though. This is not the behaviour I want though :)
zenogais: Up and coming project, although it's gonna take a while :P
Cyberman
September 28th, 2004, 20:48
You're probably talking about inetd/xinetd, which works somewhat that way. It listens on all ports specified to it and launches the appropriate daemon - I don't know the exact calling semantics etc though. This is not the behaviour I want though :)
zenogais: Up and coming project, although it's gonna take a while :P
I don't believe you can just launch a program and expect it to be able to safely operate the way you want under unix, it has to have the right group and user settings first of all. Permissions etc. I'm not sure if unix will allow just any program to serve on a port.
This reminds me I need to change my http ports on my Linux box.
SIGH My Firewall router won't reroute a http request at 8000 to 80 (whine).
Cyb
Slougi
September 29th, 2004, 12:47
I don't believe you can just launch a program and expect it to be able to safely operate the way you want under unix, it has to have the right group and user settings first of all. Permissions etc. I'm not sure if unix will allow just any program to serve on a port.
This reminds me I need to change my http ports on my Linux box.
SIGH My Firewall router won't reroute a http request at 8000 to 80 (whine).
Cyb
You need root privileges for ports below 1024. IE, either run as root as setuid. Now security stuff is interesting ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.