开发者

Basic question about socket programming using Boost ASIO

开发者 https://www.devze.com 2023-03-16 02:02 出处:网络
I am relatively new to socket programming. I am currently trying examples provided with boost::asio. I have a general question a开发者_高级运维bout sockets.

I am relatively new to socket programming. I am currently trying examples provided with boost::asio. I have a general question a开发者_高级运维bout sockets.

Lets say I am connecting a remote endpoint using tcp::socket.connect(endpoint,error) function. Can I both send and receive using the same socket object or do I have to create another socket object to send the data?

Thanks, Devendra


Yes, you can both send and recv on the same socket. E.g a typical use of a client socket would be to connect, send some data, read some data, etc depending on the protocol.

A useful link to learn about boost asio would be a free eBook by Boris Schäling: http://en.highscore.de/cpp/boost/index.html

0

精彩评论

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