Azure / DotNetty

DotNetty project – a port of netty, event-driven asynchronous network application framework
Other
4.09k stars 977 forks source link

File Transfer #346

Open battermaster opened 6 years ago

battermaster commented 6 years ago

Is there any File Transfer examples ?

zzlover commented 6 years ago

up

sunriseyuen commented 6 years ago

up

hey-red commented 6 years ago

Example about multipart/form-data upload? I can write basic example.

aronweiler commented 6 years ago

How about an example where two TCP nodes stream a file between them? Doesn't seem to be supported very well...

haoljp commented 4 years ago

up

cocosip commented 4 years ago
_bootStrap
                    .Group(_group)
                    .Channel<TcpSocketChannel>()
                    .Handler(new ActionChannelInitializer<ISocketChannel>(channel =>
                    {
                        IChannelPipeline pipeline = channel.Pipeline;
                        pipeline.AddLast("filewriter", new ChunkedWriteHandler<IByteBuffer>());
                         ...
                    }));
var stream=new MemoryStream();
var chunkedStream= new  ChunkedStream(new MemoryStream());
 _channel.WriteAndFlushAsync(chunkedStream);

but if the stream is FileStream ,it will cause a deadlock ! you can define a new type of ChunkedStream ,to fix this bug. https://github.com/cocosip/FastDFSCore/blob/master/src/FastDFSCore/Client/DotNetty/FixChunkedStream.cs

TailyFair commented 4 years ago

Simple full example would be really useful.