wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Client-Server problem - closed socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Client-Server problem - closed socket" Watch "Client-Server problem - closed socket" New topic
Author

Client-Server problem - closed socket

Janis Strautins
Greenhorn

Joined: Dec 12, 2012
Posts: 18
Hi.
Im making a client-server program, in which the client requests a file and the server sends it. Everything runs fine, if the file name is hardcoded in the server.. Here is the code for both sides managing the sending, and please, if you have time, could you explain some more? I just started networking, but i need to create this program asap :|

Server part:


Client part:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

You didn't say what you need explained. You only told us that the code worked correctly under certain circumstances, but not what happened otherwise. So I don't see a question here. Perhaps you could ask something specific?
Janis Strautins
Greenhorn

Joined: Dec 12, 2012
Posts: 18
Why is there an error, that the sockets are closed? Luckily i think i found the answer to that, closing a stream associated with a socket, closes the socket, am i right?
Are there any comments, recomendations on the code, it is now fully working, but i want to double check.

Client part:

Server part:


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client-Server problem - closed socket