How can I send an std::vector<std::string> over a UNIX socket?

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-04-17T04:26:35Z Indexed on 2010/04/17 4:33 UTC
Read the original article Hit count: 159

Filed under:
|
|

For my application, I need to be able to send an std::vector<std::string> over a UNIX socket(local), and get a copy of the vector on the other end of the socket. What's the easiest way to do this with O(1) messages relative to the size of the vector(i.e. without sending a message for each string in the vector)?

Since this is all on the same host, and because I control both ends of the socket, I'm not concerned with machine-specific issues such as endinness or vector/string representation.

© Stack Overflow or respective owner

Related posts about c++

Related posts about sockets