you can use the standard stl containers as queue, e.g. a simple vector<Message> will do the job. don't mess with arrays in c++ until you have to. the indicator that no message is in the queue just is vector::empty().
for your messages you can use a simple thing like this:
Code:
struct Message
{
string sender_id;
string receiver_id;
string body;
boost::time(?) time_sent;
...
};
objects of that struct are just pushed in the vector if received or popped out of the outgoing vector if sended.
serialisation just means that if your sender thread is taking a message from outgoing queue he has to build a "linear stream" from the (structured) object. A really simple form would be for example
Code:
stringstream ss;
ss << strlen(message1.sender_id.c_str() ) << message1.sender_id
<< strlen(message1.receiver_id.c_str() ) << receiver_id
<< strlen(message1.body.c_str() ) << body;
// the strlen-things in it announce how many chars of an message
// object attribute will follow. youl'll need them if your receiver
// thread is rebuilding (de-serialize) the message object
than you can pass reinterpret_cast<void*>(ss.str().c_str()) as buffer to your send() call to transmit the message to a socket.
de-serialization just works the other way around. now the only thing I'll hvae to lern are threads:
http://www.ibm.com/developerworks/library/l-posix2/
oh and in the case you havent found it yet, the good old "Beej's Guide to Network Programming Using Internet Sockets"
http://beej.us/guide/bgnet/output/ht...age/bgnet.html