You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Frédéric Brégier <fr...@free.fr> on 2007/11/21 19:51:25 UTC

transferring files with Mina

Hi all,
I feel that the question I post inside my long previous mail should
be on a separate one, so here it is again. Sorry for the double post !

Just a question perhaps stupid :
I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to transfer some files
but with a protocol exchange before and after the file transfer (to verify the access, the rules,
to make some pre or post operations, probably making an MD5 check of the transfered file...).
I have look at the mailing list but I didn't find a good example of what could be the best
but also I didn't understand how to "get" the file on the other side.
That is to say : I saw some code to send file (using StreamWF) but no on receiving this file?
I'm surely missing something, obviously...

Frederic

Re: transferring files with Mina

Posted by Mark <el...@gmail.com>.
I have used StreamIoHandler for just what you are looking to do before.  It
has served me well


On Nov 21, 2007 1:51 PM, Frédéric Brégier <fr...@free.fr> wrote:

> Hi all,
> I feel that the question I post inside my long previous mail should
> be on a separate one, so here it is again. Sorry for the double post !
>
> Just a question perhaps stupid :
> I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to
> transfer some files
> but with a protocol exchange before and after the file transfer (to verify
> the access, the rules,
> to make some pre or post operations, probably making an MD5 check of the
> transfered file...).
> I have look at the mailing list but I didn't find a good example of what
> could be the best
> but also I didn't understand how to "get" the file on the other side.
> That is to say : I saw some code to send file (using StreamWF) but no on
> receiving this file?
> I'm surely missing something, obviously...
>
> Frederic
>



-- 
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and allows
them to remain undismayed at the proximity of "normal" to average and
mediocre. For surely anyone who achieves anything is, essentially, abnormal.
    Dr. Karl Menninger

Re: transferring files with Mina

Posted by fr...@free.fr.
Thank you to pointing this discussion, but as I said, no example
on client side ?
Now about the MD5, I agree with you on compute MD5 locally globally
on the file and comparing at the end.

However, if I send by packet as Trustin suggested, I come back to my previous
idea which was to compute MD5 on each packet, since it will bring some
extra functionnalities that could be interesting on large files.
For instance it allows to resend only the "corrupted" packet, restart a
transmission from a synchronisation point (like some FTP servers do), ...

As it takes some complexity to implement, I was looking at the new functionality
of Mina to see if I can use a simpler way...

I need to think about a clean way, perhaps something modular that can be reused
easily...

Frederic

Selon Eero Nevalainen <ee...@indagon.com>:

> This discussion brought to mind an earlier one about sending large files
>
http://www.nabble.com/Question-for-transfering-large-file-tf4222408s16868.html#a12011448
>
> What about the option of calculating the MD5 locally and then sending
> the file and the checksum after that?
>
> -Eero Nevalainen
>
> fred.bregier@free.fr wrote:
> > Hi Trustin,
> > (sorry for so much mails ;-)
> > Bloking IO could be problematic so I will probably work on the second
> > option (in fact my initial thoughts).
> > My initial work was based on serialization but I fell like it could
> > be no as efficient as needed, so I need to rethink about it and write
> > a protocol from scratch which will include a MD5 check on each packet
> > (security and check of file transport is the key of this project).
> > Thank a lot
> > Frederic
> >
> >
> > Selon Trustin Lee <tr...@gmail.com>:
> >
> >> On Nov 22, 2007 3:51 AM, Frédéric Brégier <fr...@free.fr> wrote:
> >>> Hi all,
> >>> I feel that the question I post inside my long previous mail should
> >>> be on a separate one, so here it is again. Sorry for the double post !
> >>>
> >>> Just a question perhaps stupid :
> >>> I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to
> >> transfer some files
> >>> but with a protocol exchange before and after the file transfer (to
> verify
> >> the access, the rules,
> >>> to make some pre or post operations, probably making an MD5 check of the
> >> transfered file...).
> >>> I have look at the mailing list but I didn't find a good example of what
> >> could be the best
> >>> but also I didn't understand how to "get" the file on the other side.
> >>> That is to say : I saw some code to send file (using StreamWF) but no on
> >> receiving this file?
> >>> I'm surely missing something, obviously...
> >> For now.. you can:
> >>
> >> 1) Use StreamIoHandler, which is not recommended because it makes MINA
> >> work like a blocking I/O server.  However, it's fine as long as you
> >> limit the usage of the StreamIoHandler.
> >> 2) Create a chunk message so your decoder generate multiple chunks
> >> with begin and end mark.
> >>
> >> Please let me know if you have any better idea to deal with big files. :)
> >>
> >> Trustin
> >> --
> >> what we call human nature is actually human habit
> >> --
> >> http://gleamynode.net/
> >> --
> >> PGP Key ID: 0x0255ECA6
> >>
> >
> >
>
>



Re: transferring files with Mina

Posted by Eero Nevalainen <ee...@indagon.com>.
This discussion brought to mind an earlier one about sending large files
http://www.nabble.com/Question-for-transfering-large-file-tf4222408s16868.html#a12011448

What about the option of calculating the MD5 locally and then sending 
the file and the checksum after that?

-Eero Nevalainen

fred.bregier@free.fr wrote:
> Hi Trustin,
> (sorry for so much mails ;-)
> Bloking IO could be problematic so I will probably work on the second
> option (in fact my initial thoughts).
> My initial work was based on serialization but I fell like it could
> be no as efficient as needed, so I need to rethink about it and write
> a protocol from scratch which will include a MD5 check on each packet
> (security and check of file transport is the key of this project).
> Thank a lot
> Frederic
> 
> 
> Selon Trustin Lee <tr...@gmail.com>:
> 
>> On Nov 22, 2007 3:51 AM, Frédéric Brégier <fr...@free.fr> wrote:
>>> Hi all,
>>> I feel that the question I post inside my long previous mail should
>>> be on a separate one, so here it is again. Sorry for the double post !
>>>
>>> Just a question perhaps stupid :
>>> I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to
>> transfer some files
>>> but with a protocol exchange before and after the file transfer (to verify
>> the access, the rules,
>>> to make some pre or post operations, probably making an MD5 check of the
>> transfered file...).
>>> I have look at the mailing list but I didn't find a good example of what
>> could be the best
>>> but also I didn't understand how to "get" the file on the other side.
>>> That is to say : I saw some code to send file (using StreamWF) but no on
>> receiving this file?
>>> I'm surely missing something, obviously...
>> For now.. you can:
>>
>> 1) Use StreamIoHandler, which is not recommended because it makes MINA
>> work like a blocking I/O server.  However, it's fine as long as you
>> limit the usage of the StreamIoHandler.
>> 2) Create a chunk message so your decoder generate multiple chunks
>> with begin and end mark.
>>
>> Please let me know if you have any better idea to deal with big files. :)
>>
>> Trustin
>> --
>> what we call human nature is actually human habit
>> --
>> http://gleamynode.net/
>> --
>> PGP Key ID: 0x0255ECA6
>>
> 
> 


Re: transferring files with Mina

Posted by fr...@free.fr.
Hi Trustin,
(sorry for so much mails ;-)
Bloking IO could be problematic so I will probably work on the second
option (in fact my initial thoughts).
My initial work was based on serialization but I fell like it could
be no as efficient as needed, so I need to rethink about it and write
a protocol from scratch which will include a MD5 check on each packet
(security and check of file transport is the key of this project).
Thank a lot
Frederic


Selon Trustin Lee <tr...@gmail.com>:

> On Nov 22, 2007 3:51 AM, Frédéric Brégier <fr...@free.fr> wrote:
> > Hi all,
> > I feel that the question I post inside my long previous mail should
> > be on a separate one, so here it is again. Sorry for the double post !
> >
> > Just a question perhaps stupid :
> > I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to
> transfer some files
> > but with a protocol exchange before and after the file transfer (to verify
> the access, the rules,
> > to make some pre or post operations, probably making an MD5 check of the
> transfered file...).
> > I have look at the mailing list but I didn't find a good example of what
> could be the best
> > but also I didn't understand how to "get" the file on the other side.
> > That is to say : I saw some code to send file (using StreamWF) but no on
> receiving this file?
> > I'm surely missing something, obviously...
>
> For now.. you can:
>
> 1) Use StreamIoHandler, which is not recommended because it makes MINA
> work like a blocking I/O server.  However, it's fine as long as you
> limit the usage of the StreamIoHandler.
> 2) Create a chunk message so your decoder generate multiple chunks
> with begin and end mark.
>
> Please let me know if you have any better idea to deal with big files. :)
>
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>



Re: transferring files with Mina

Posted by Trustin Lee <tr...@gmail.com>.
On Nov 22, 2007 3:51 AM, Frédéric Brégier <fr...@free.fr> wrote:
> Hi all,
> I feel that the question I post inside my long previous mail should
> be on a separate one, so here it is again. Sorry for the double post !
>
> Just a question perhaps stupid :
> I have the idea to perhaps use StreamWriteFilter or StreamIoHandler to transfer some files
> but with a protocol exchange before and after the file transfer (to verify the access, the rules,
> to make some pre or post operations, probably making an MD5 check of the transfered file...).
> I have look at the mailing list but I didn't find a good example of what could be the best
> but also I didn't understand how to "get" the file on the other side.
> That is to say : I saw some code to send file (using StreamWF) but no on receiving this file?
> I'm surely missing something, obviously...

For now.. you can:

1) Use StreamIoHandler, which is not recommended because it makes MINA
work like a blocking I/O server.  However, it's fine as long as you
limit the usage of the StreamIoHandler.
2) Create a chunk message so your decoder generate multiple chunks
with begin and end mark.

Please let me know if you have any better idea to deal with big files. :)

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6