Hi all,
I'll try to make it very easy to understand, so if you want more
details, just ask.
I have a system composed of some perl scripts running on several
machines interconnected with a network (usually local but it can be
internet also).
These scripts communicate with each other by sending xml strings with
IO::Socket. The read socket (receiving the string) is always opened. The
write socket (sending the string) is opened when needed. As the messages
where usually really short and treated really fast, I just used one
socket on each side for receiving. No special other socket opened, no
connection acknowledgement, just one string sent and replied. Then the
receiver can accept another message (from another script or whatever).
Now it just happens I would like to send some files additionnaly (also
binary files, more than 1MB sometimes). My first idea was to "freeze"
the file as a variable into my xml string. Well... this seems to be a
bad idea, because the time taken to freeze and thaw is really long for
that kind of data. Also, the volume seems to be about 1,5 the original
volume (because I have to transform the freezed string so as to have a
string that passes through an xml parser -> BASE64)
Then I thought about FTP module. But this one is only a client, isn't
it?
So my problem is: How can I send my binary file so as to keep the
unicity of my message and a nice speed?
The problem of unicity is if another script sends a message before the
first script has time to receive the acknowledgement and send his file,
the file sent later won't be recognized as the file the receiver was
waiting for (but the "alien" message will, although he's not). And if I
develop some way to open another port or something, I will have to do
that so as to accept the files on multiple ports (if 2 scripts want to
send a file at the same time).
My scripts are not to be used with more than three users at the same
time and wouldn't normally be stucked in multiple files problem, but the
problem of speed is really important as it takes 10 minutes for a script
to thaw and traduce a 1MB binary file on a local network 10Mb/s)
Thanks for any suggestion,
Yannick