Network file transfer

metalstorm metalheadstorm at gmail.com
Mon Oct 10 17:12:18 EDT 2011


The c# app sends a file name, size etc to the client which is then followed
by the file (data)

Its a P2P app, i cant remember the proper name, but each application has
both a client and server running. Servers send files to clients and *not*
vice versa.

The Http stuff like, "
http://localhost:8080/?file=c:/myfiles/myfilepath.txt" is unneeded from what
i can tell, and from what i see in my head, all the file related data is
held in a custom packet object and serialized/deserialized before actual is
sent.

So there's no build in file handling stuff (client side) in netty for file
transfers ? So clients would have something like:


		InputStream in = sock.getInputStream();
		FileOutputStream out = new FileOutputStream("received.txt");

		int bytes = 0;
		byte[] buffer = new byte[8192];
		int len;


		while ((len = in.read(buffer)) > 0)
		{
			out.write(buffer, 0, len);
			bytes += len;
		}

		out.close();
		sock.close();

Sorry to be a pain with all the questions, but im trying to get this right
:)

thanks again.

--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Network-file-transfer-tp6875434p6878549.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list