nixfindus
nixfindus

Reputation: 31

Python write string to memory an read the memory with other Python program

I receive with my Python program a string with 12 comma separated values over Ethernet.

Now I want to provide the values for other programs but I do not want to write the values in a file. Writing to a file would occur very often and would thus strain the SD-card of my RaspberryPi.

The other programs must only read and not write the values.

Please can some one tell me if I have a chance to write the complete string or the separated values to a defined space of the memory an read this space with other Python programs?

I use python in the version 2.7.

I hope my English is good enough to explain the problem. Thank you for the Help.

Upvotes: 3

Views: 1412

Answers (2)

Ewan
Ewan

Reputation: 15058

@dsh has already provided some info on shared memory, the other (slightly higher level) idea I could recommend is using python sockets.

They have a great how-to on implementing sockets and I'd recommend you check out a non-blocking, STREAM socket to communicate between your programs.

Upvotes: 2

dsh
dsh

Reputation: 12213

You are looking for information about shared memory. I haven't used it, personally, but here are some resources I found:

Upvotes: 3

Related Questions