I have a c++ programme. There are two processes which run in two terminal.

Take a easy example, Process A is a sender and Process B is a receiver.

They are connected through TCP/IP protocol by Boost.

Process A can send Data and process B will receive and then write them in an int array. Like int mem[32]

The problem I met is that it is too slow. Is there a way to access "mem[32] of Process B" directly from Process A so that TCP/IP can be bypassed? Like passing some pointers?(As the two process are located in the same computer, there shall be some ways to access common memory places?)

So is that possible? What shall I look into? (memory management?)

Thanks

有帮助吗?

解决方案

You can use the Boost.Interprocess library to create a shared memory that can be accessed by multiple processors.

其他提示

Memory of a process could not commonly be accessed by another process.

You could share pointer between threads, but not between processes.

Have you try to use sockets, it is commonly used to communicate between processes, and also could be used between separated computers ?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top