The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

reply

Posted by Pavan Kumar Keely on December 31, 2001 at 1:39 AM

> i am trying to send a file over a socket connection.
> a server gets a request and socket connection is established.
> so far so good.
> now i want to open streams on the server side, but it i need both input streams and output streams. input to read request type from client and output to write the file to client.
> it goes like this: first, server reads request from inputstream. second, server sends file. third, server (tries to) read from inputstream again, to see if there are additional requests or end of request code.
> my problem is on the third step, the server wont read anything more at this point it seems, it just blocks, why? I am sending more data from the client, so its not that.
> Id be very gratefull for tips on this. Thanks.
> /sebastian


Hi,

That may be a little problem in coding the things.
How are you specifying the end of file transfer to the client. If the client doen't know the completion of transfer it blocks the way. If you want to make this synchronous then using the proper threading mechanism you can do this.

Otherwise follow your own protocol to specify the file size and let the client know the trnasfer complete.

This may help you in reaching the goal...if not feel free to contact me at keelypavan@hotmail.com

bye
Pavan Kumar Keely,
Software developer, Quillis india



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us