Results 1 to 1 of 1
- 07-20-2012, 07:34 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
Transmitting files of 64k size through sockes fails.
Hello everybody,
I am developing an application that uses java sockets between a server and client apps. I need to send files of size 64k from client to server through these sockets. When I locally run all the system (both, server and client) everything goes ok, but when I run the server and client in different machines it fails.
I am using JSON to process the file content, so the thrown exception in server is: "net.sf.json.util.JSONTokener.syntaxError". However the problem is not JSON, is the size of the file. When I send files with a size lesser than 8k everything goes ok, but bigger sizes truncates the sent information, so it throws a JSONTokener.syntaxError when server tries to interpret truncated received information.
I am defining a socket buffer of 64k as following (I am using NIO API):
SocketChannel sc;
private static final int BUFFER _SIZE = (int)Math.pow(2, 16);
.....
sc.socket().setReceiveBufferSize( BUFFER_SIZE );
sc.socket().setSendBufferSize( BUFFER_SIZE );
What do I need to do to enlarge the network package size when I run my system in a remote mode? Do you have any idea which is the problem?
Thank you very much in advance.
Oscar
Similar Threads
-
Writing zip files results in a zip file with a size, but no files when i open it
By Jaeela in forum New To JavaReplies: 11Last Post: 12-04-2011, 10:10 PM -
Transmitting objects over a small LAN with only trusted clients
By N4zroth in forum Advanced JavaReplies: 0Last Post: 12-17-2010, 01:53 PM -
Merged TIF file size is more larger than the sum of single TIF files
By subrahmanyam.adapa in forum Advanced JavaReplies: 3Last Post: 01-26-2009, 01:19 PM -
Can't Stop packet from transmitting and unable to understand packet format
By khajalid in forum NetworkingReplies: 2Last Post: 12-22-2008, 03:05 AM -
Please help Transmitting Audio and Video using RTP
By pedaramanareddy in forum New To JavaReplies: 0Last Post: 01-03-2008, 02:39 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks