What's new

Good, free, open-source, thread-safe, cross-platform, c++ network programming lib?

Hacktarux

Emulator Developer
Moderator
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.
 
Last edited:

Cyberman

Moderator
Moderator
Slougi said:
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
 
Last edited:
OP
S

Slougi

New member
Cyberman said:
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

?????????????????????????
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

Emulator Developer
Moderator
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
 
OP
S

Slougi

New member
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

New member
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

Moderator
Moderator
Slougi said:
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

New member
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.
 
OP
S

Slougi

New member
Cyberman said:
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

Moderator
Moderator
Slougi said:
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
 
OP
S

Slougi

New member
Cyberman said:
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 ;)
 

Top