Simple file transfer

Overview

To compile and link the files set your environment in the same way as you do to build OpenAMQ server and do the following:

$ c -l send_file.c
Compiling send_file...
Linking send_file...
$ c -l receive_file.c
Compiling receive_file...
Linking receive_file...

To run the whole thing, you have to start OpenAMQ server first:

$ amq_server

Once the server is running you can run your file receiver application:

$ receive_file <broker-addeess> <file-name>

For example:

$ receive_file 127.0.0.1:5672 test.txt

To send the message use send_file this way:

$ send_file <broker-addeess> <file-name>

For example:

$ send_file localhost:5672 test.txt

Caution: Do not try to transfer very large files! The example reads the file content into memory prior to sending it. Sending large file can exhaust the memory and cause your system to swap and slow down in considerable manner.

License

BSD licensed, as follows:

Copyright (c) 2007, iMatix Corporation, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the iMatix Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Support

  • Contact author for support.

Download

Comments

Add a New Comment

Edit | Files | Tags | Source | Print

rating: +2+x

Author

Martin Sustrik <moc.xitami|kirtsus#moc.xitami|kirtsus>

All examples

Simple file transfer: A simple file transfer application in C, an example of how to send and receive messages via OpenAMQ WireAPI.

Chatroom example: A simple instant messaging application in C, an example of how to send and receive messages via OpenAMQ WireAPI.