Transfer files with Socket
1 posts in topic
Flat View  Flat View

Posted By:   Anonymous
Posted On:   Friday, August 30, 2002 01:19 AM

Hi , I need to transfer(by socket) one file as file.gif(125 kb)

from a remote PC to my PC. I have just used some attempts

but they dont't works correcly.Can you show me an affidable

example about?

Re: Transfer files with Socket

Posted By:   Anonymous  
Posted On:   Tuesday, September 3, 2002 02:30 AM

you know the size of the file so try this:

first set your socket receive Buffer Size:

socket.setReceiveBufferSize( 1500 );

byte[] read_bytes = new byte[1500];

FileOutputStream file_output = new FileOutputStream( String dest_filename, boolean append );

for( int i = 1 ; i <= file_size ; ){

i += socket.getInputStream().read( read_bytes ) ;

file_output.write( read_bytes ) ;


hope this will help

About | Sitemap | Contact