   Oh the joys of networking...
  All of the programming I've done up until about 6 months ago involved no networking.  When I got my current job they had me write some C++ library that would upload and download files, as well as POST info, to/from one of our servers.  I used libcurl for all the networking stuff.Well now that I've got a little more free time I can resume work on my own personal projects.  Networking is going to be a critical part of my current project.  Here's a little, simplified breakdown of what I need to do.  I've got my main program that the user will be using.  That main program needs to go out and connect to various computers (the user will tell it which ones, and the various computers it connects to will have the same program running).  Once connected, the main program needs to send information and retrieve information from the other computers.  At the same time, the other computers need to send information and retrieve information from the main computer.  The other computers don't need to have any knowledge of each other; they just need to talk to the main computer, and the main computer needs to talk to them.I decided that the best way to get some practice in would be to write a simple chat system.  At first libcurl came to mind, but I don't think that would work because, AFAIK, you can only send info with it.  You can't have it listen and receive requests.  Then I thought of Boost Asio.  I believe this would work for the simple chat program and for my main program, but then I realized I also need a way for my program to be able to automatically check for updates and apply patches (which would be really easy to do with libcurl).  So here's my question: do I have to use both Boost Asio and libcurl?  I'd use Boost Asio for my program's network communication and libcurl for downloading the latest patches and what not.  I believe I could use Boost Asio for the auto-updating, but looking at the examples it seems like a lot of work.Anyway, here's my simplified question: do I use both Boost Asio and libcurl, or can I (easily) use one or the other to accomplish all my tasks?  Or is there a 3rd option I've missed?Oh, and just FYI, this is a C++ cross-platform program.   
  I personally would just build my own network layer using Berkeley sockets (which are supported on basically all relevant platforms that support networking). It's not really that much work and it offers a lot more control over exactly how your system is built. It also avoids the nasty problem of net code that doesn't quite do everything you need, and therefore you have to use multiple libraries with overlapping functionality.   ;  I prefer using RakNet. It's for free and can give you as much control as using raw sockets (imo) but offers a really nice and easy interface. I really enjoyed writing applications with it.RakNet is also documented very well and the creator seems to be quick when answering questions in his forum (though I only skimmed over the forums).Apart from the core, RakNet also offers a growing library of plugins that implement functionality that is very useful (like auto-patching, a lobby, etc...).   ;Quote:Original post by ApochPiQI personally would just build my own network layer using Berkeley sockets (which are supported on basically all relevant platforms that support networking). It's not really that much work and it offers a lot more control over exactly how your system is built. It also avoids the nasty problem of net code that doesn't quite do everything you need, and therefore you have to use multiple libraries with overlapping functionality.I'm no expert with Berkeley sockets, but does the Berkeley sockets API give you anything more than Boost Asio?  To me it seems like Boost Asio is very similar in functionality; Boost Asio just seems to have some sugar and a few added extra features.  A part of me wants to roll my own code that wraps around Boost Asio (or Berkeley sockets), but I first want to make sure I don't miss any awesome options I could utilize (especially since I'm not a networking guru and I hate reading RFCs).Quote:Original post by SiS-ShadowmanI prefer using RakNet. It's for free and can give you as much control as using raw sockets (imo) but offers a really nice and easy interface. I really enjoyed writing applications with it.RakNet is also documented very well and the creator seems to be quick when answering questions in his forum (though I only skimmed over the forums).Apart from the core, RakNet also offers a growing library of plugins that implement functionality that is very useful (like auto-patching, a lobby, etc...).Ah yes, I had hear about RakNet once upon a time but had completely forgotten about it and never looked at it.  I just went to their site and it's... impressive.  While this program isn't actually a game (it's actually a fractal program), RakNet sounds like it has a lot of very handy features.  The only thing that scares me is the licensing (the Indie license would work just fine, but I hate knowing that there are restrictions, even though I know I'll never actually get to the point to notice those restrictions).  I'll have to look into it more, but it sounds great.   ;  Honestly I personally have no experience with Asio so I can't really comment on that; in any case I've done a fair bit more with sockets in the *nix world than on Windows so I'm most comfortable with using sockets directly. This of course does not in any way mean that sockets are the right approach for you, though [wink]   ;Quote:Original post by ApochPiQHonestly I personally have no experience with Asio so I can't really comment on that; in any case I've done a fair bit more with sockets in the *nix world than on Windows so I'm most comfortable with using sockets directly. This of course does not in any way mean that sockets are the right approach for you, though [wink]I haven't done too many tutorials on sockets, and the ones I have done were confusing to me.  The Boost Asio documentation is pretty lacking (though it's better now than it used to be), and if I were to use Berkeley sockets I'd have to use the API on *nix and Winsock on Windows, which is something I'd like to avoid.  Anyway, how much work do you think it would be to create some system (using Berkeley sockets (though I'd actually use Boost Asio)) that could do:HTTP and HTTPS 1.1GETPOST (including multipart forms)PUTHEADI may discover something and add it to that list, but realistically, how much work would it be to implement such a system?  It's very tempting to do it, but I want to make sure I also don't lose focus of my original program and end up writing a huge networking library.   ;  There's no need to use Winsock; Windows provides a conforming implementation of sockets, so you can use the exact same code on multiple platforms with no real effort. (This is part of why I like using sockets: they're much easier to get to a portable state.)I've written simple HTTP servers before for semi-embedded systems; it's got some pitfalls but once you understand the basics of sockets it's really not much work to get the networking side done. What gets messy is parsing HTTP headers, because the HTTP RFC totally sucks [smile]HTTPS is looking at a fairly large amount of work, if you really want secure transmission: you have to do things like confirm the validity of the remote host's certificate, etc. etc.   ;Quote:Original post by ApochPiQThere's no need to use Winsock; Windows provides a conforming implementation of sockets, so you can use the exact same code on multiple platforms with no real effort. (This is part of why I like using sockets: they're much easier to get to a portable state.)Oh cool, that's good to know.Original post by ApochPiQI've written simple HTTP servers before for semi-embedded systems; it's got some pitfalls but once you understand the basics of sockets it's really not much work to get the networking side done. What gets messy is parsing HTTP headers, because the HTTP RFC totally sucks [smile]Yeah, the headers are what I'm mostly afraid of.  Maybe I could use Boost Spirit to help with parsing...Quote:Original post by ApochPiQHTTPS is looking at a fairly large amount of work, if you really want secure transmission: you have to do things like confirm the validity of the remote host's certificate, etc. etc.I was afraid of that.  Boost Asio has SSL support (by using OpenSSL), but I don't really understand certificates and all that.  Maybe I don't need full on HTTPS support.  I think I can get around that, which should simplify everything.Now if only Boost Asio had a better API reference.  It sucks as is.  And if only RakNet was TCP instead of UDP.;Quote:Now if only Boost Asio had a better API reference.What's wrong with it?It's even better than the average Boost library, which is usually good.   ;  I'm using SDL_net. Fairly simple to use, although I haven't used any of the others, so I don't know if it's a better choice than other peoples suggestions.   