I need to be able to send an std::string over a LAN network. In my case I have a mac, and a PC that I would like to be able to make communicate. I have taken a look around the web, but haven't had much lucky in terms of solution for my case. Any ideas how I could set up a network through c++ so these computers can share text?
Asked
Active
Viewed 1,058 times
-4
-
1You should give this a read https://stackoverflow.com/questions/22797418/how-do-i-safely-pass-objects-especially-stl-objects-to-and-from-a-dll – Cory Kramer Jun 02 '15 at 19:21
-
Have you looked at the Socket API? What have you tried already? Do you have a more specific programming question? – JAL Jun 02 '15 at 19:25
-
Is it a local area LAN network? Or another kind of LAN network? – Lightness Races in Orbit Jun 02 '15 at 19:26
-
@JAL: C++ doesn't have a Socket API. – Lightness Races in Orbit Jun 02 '15 at 19:27
-
Lightness Races in Orbit, It is a local area network. Just all of the computers that are connected to my router. – 24GHz Jun 02 '15 at 19:29
1 Answers
1
The boost asio library provides a robust framework for doing network communication through sockets. Examples using C++11 can be found here: http://www.boost.org/doc/libs/1_58_0/doc/html/boost_asio/examples/cpp11_examples.html
The chat client/ server examples may be of particular interest to you.

Christian Blume
- 188
- 1
- 9
-
Thanks for the help. I haven't tried any of the examples yet, but it should give me a start. – 24GHz Jun 05 '15 at 03:08