[Vortex] Question about ausage pattern

Robert M. Münch robert.muench at robertmuench.de
Sun Mar 30 17:11:22 CEST 2008

Hi, I have a question how to make best use of vortex lib in the following  

I have a simple "file transfer" profile. The initiator sends a message,  
requesting a file, the reciever get a filename and sends the file. So it's  
most like the simple-file-transfer examples included in Vortex.

Now the question is, the initiator uses a frame-recieved handler to write  
the recieved data. But, how to get either the filename or the filepointer  
to this handler? I don't want to use globals because there can be more  
than one file transfer at the same time, vortex is threaded etc.

I see the following options:

1. I open a channel and beside the profile I specify the filename to use.  
In this case every transfer gets it's own channel.

How big is the overhead to open / close channels? At the moment I think a  
channel is once opened and than stays open for a longer period.

2. The initiator already sends the filename to the sender. The sender  
could reply with an answer ackknowleding that the file was found by  
sending back the filename as the first answer. All following answers than  
will be the file content.

I don't know if it's complex to handle the first answer as a special  
answer on the initiator side and than enter a loop to recieve the file  

3. I somehow setup something like a queue or register on the initiator  
side, where the filename and channel number will be tracked. Than the  
channel handler can lookup what filename to use.

This implies that there is only one transfer at the same time for one  
channel. Which I think is no restriction. Depending on the size of the  
register (if not done dynamically) the number of concurrent transfers is  

What do you think is the best approach that fits to vortex? Am I missing  
an other more elegent solution?

Best regards.

Robert M. Münch

More information about the Vortex mailing list