When i am sending large files of size around 3 mb or so, after sending around 7-10 files the socket breaks and the communication stops.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Puneet_Gupta
Posted On:   Tuesday, October 28, 2003 11:26 PM

I have a client and server in sender and receiver mode. I open the sockets and the cleint connects to the server. I am using this to transfer files from the sender to the receiver side. Files are of large size ranging from 2 mb to 6 mb. Initially, i was using byte[] to read text from the file and forming a java object which contains the file name, the file content and file length and send it to the receiver side. There was a lot of memory leakage somehow. Its like per message around 15 mb memory was leaking. i dont know how, probably Garbage Collector culdnt conserve the memory. Beacuse of which the socket was breaking. Now i am using StringBuffer instead of the byte[]. Though the memory isnt leaking to an extent it was leaking earlier but even after that the socket br   More>>

I have a client and server in sender and receiver mode. I open the sockets and the cleint connects to the server. I am using this to transfer files from the sender to the receiver side. Files are of large size ranging from 2 mb to 6 mb. Initially, i was using byte[] to read text from the file and forming a java object which contains the file name, the file content and file length and send it to the receiver side. There was a lot of memory leakage somehow. Its like per message around 15 mb memory was leaking. i dont know how, probably Garbage Collector culdnt conserve the memory. Beacuse of which the socket was breaking. Now i am using StringBuffer instead of the byte[]. Though the memory isnt leaking to an extent it was leaking earlier but even after that the socket breaks. Please someone help me. If the problem is not clear feel free to revert back.

   <<Less

Re: When i am sending large files of size around 3 mb or so, after sending around 7-10 files the socket breaks and the communication stops.

Posted By:   Benoit_Quintin  
Posted On:   Wednesday, October 29, 2003 01:53 PM

yes, well I'm reverting back to you.. (!) Depending on how you create your objects, and release the former objects, as long as the objects are reachable they aren't garbage collected. Therefore, your code must keep the references to old byte[] objects (or even to StringBuffers).

You should show us a bit of code.

About | Sitemap | Contact