On Oct 29, 11:13 pm, gaurav kashyap <[EMAIL PROTECTED]> wrote: > Dear all, > > I have a server program that listens to a particular port and a number > of client programs that connect to the server. > > Now i want to put some data in form of python list in main memory on > server.Hence whenver a client program is run it connects to the server > and access the data in main memory.Here the server calls a module that > processes the data as per the client request and the returns some > information to the client. > > I can create client and server programs using socket programming,but i > am not able to put the data in shared memory and then access it. > > NOTE:I want to put the data in main memory only once(on the server > using server program) i.e. whenever client connects to the server it > should only access the data and not create a replica of data already > loaded in memory.How can this be achieved > > thanks.
Shared memory is available in the 'mmap' module. However, you can't share a Python list object between processes. The closest you can do is share a ctypes.Array or struct.Struct. -- http://mail.python.org/mailman/listinfo/python-list