开发者

C++ File Sending Program

So I need to introduce myself to sockets and general network programming. I consider myself fluent in C++, but I basically can build stuff with the basics of C++ (think having only a basic set of legos)

Now I really need to venture forth and expand my lego set to different pieces (pardon the lego metaphor) But socket开发者_Go百科 programming/network is my next target. So I thought a simple program to write would be a file sending program.

Basically a program that you type in the IP of your friend, (he has the program too) and it asks "Would you like to receive fileXXX.yyy" If he says yes, then it proceeds to send the file.

I know i'd need to know about sockets, but what else would I need to know about? Should this be a simple program to accomplish? Any recommended tutorials I read before I dive head first?

Any additional info is helpful. Thanks. And NO this is not for school, it's just kinda something I wanna learn.

C++ preferred language.


You should get yourself the boost libraries.

There is no standard socket API for C++ but boost provides one in their ASIO library that will work on multiple platforms (as is the case with all boost libraries).


beej has a good guide for unix socket programming: http://beej.us/guide/bgnet/ You can use the same code on a windows platform if you include the winsock library and an additional startup call


The Boost.Asio library mentioned in CashCow's answer is a fantastic cross-platform and easy to use library. Don't let the asynchronous name scare you, it can be a bit daunting at times but the documentation is straightforward and easy to understand.

The boost-asio tag is also fairly active on stack overflow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜