Nikhil
Nikhil

Reputation: 586

How does the server knows the message queue is destroyed

I have a written a small server client message queue program, where the server creates the message queue, writes into the queue and client gets the message queue id and reads the written data from the queue.

The problem is, client will destroy/remove the queue once the client is stopped/restarted. And the server will be attempting to write into the queue, but it fails. When the client starts again it creates a new message queue, now is there any possibilities that server can know the message queue is created and start writing into the queue. Or is there any another method to overcome this situation.

Note : Server cannot destroy the queue as the written data should be read by the client.

Thanks.

Upvotes: 1

Views: 344

Answers (1)

resultsway
resultsway

Reputation: 13300

Well, the client and server share the queue id. so you need to poll for the queueid using ipcs command.

Upvotes: 1

Related Questions