ZeroMQ File Server

EDIT:

This is no different than reading the whole file into ram and sending it in one gulp, please see the post ZeroMQ File Server, better

This is a VERY simple example but it covers the core concept of a file server in zeromq. The only real problem with sending files over the network is that they can be rather large and need to be split up, this example is really an example of using a simple ZeroMQ REP/REQ setup with zmq.SNDMORE and zmq.RCVMORE in python.

The file server is a simple REP server that receives a path to a file and then return the file in chunks using SNDMORE, The client is merely an application that sends the desired pathname to the server and then recives the chunks of the file via zmq.RCVMORE.

I have come across the need to build a file server because I need one for Salt, since salt-cp is, right now, rubbish. A file server that is fast and encrypted with the salt encryption system will also be required to execute complex state management in Salt. The file server I use in Salt will be an extension of this base concept, but obviously much more powerful.

The file server can be found here:

https://github.com/thatch45/sandbox/blob/master/examples/zmq/file_serve.py

The Client can be found here:

https://github.com/thatch45/sandbox/blob/master/examples/zmq/file_get.py

-Thomas S Hatch

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: