Interprocess communication in c/c++
I'm currently using message queue to pass message between two processes, but I'm hitting 32k maximum size limit. What's the best option. Fragmenting the message and then re-asembling or using TCP/IP sockets to communicate between processes or anything you guys coul开发者_如何转开发d help me with.
Only you can determine the right answer but unix domain sockets are probably your best alternative if you don't want to split/reconstruct the messages. Shared memory would be faster but has the associated synchronization headaches.
If the program(s) reading/writing the queue are single threaded then splitting the messages is easy enough - basically put a byte at the beginning of each segment indicating if it is a new message or a continuation of a previous one. If they are threaded I would bite the bullet and switch to something else.
精彩评论