4
votes

I'm newer to netty, and learn it with netty examples. Now i want to get file from server by send the file path. And this file is a Video, not textfile.

My client code:

enter image description here

the server code is from the github: https://github.com/netty/netty/tree/4.0/example/src/main/java/io/netty/example/file

I try it 3 days but failed. how can i receive the chunked file from server?

1

1 Answers

1
votes

I understand that you send the path to the server in a client request. So you have an handler in server to catch this path. In this handler, open/read the file to have a byte array of the content.

Then, use ctx.writeAndFlush() method in this server handler to send data (the content of your file) to the requester (the client which asked for)

You should then just catch this data on a handler, client side.