Pregunta

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

¿Fue útil?

Solución

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

Otros consejos

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 ?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top