I'm conducting a small client/server test...it's supposed to emulate a server that can handle multiple clients that connect to the server on the local machine. Currently I'm just sending the messages but have not set up and responses to come back from the server yet. I'm just checking that the name passed to the server can be looked up in the hashmap table initialised and filled by the server.
For this test, I'm just sending a few messages, one after the other, rather than using any gui / command line option to post the messages.
After these messages are sent, my program causes a 'connection reset' to be thrown ,accoridng to the stack trace.
The BufferedReader that I have on the server waiting for these messages from the client seems to be ok as it is always reading as long as the reader is not null.
I will post the code below. Can anyone help me with what is the exact cause of this socket error please?
Test Server code
Now the Runnable class to be run as a thread in the server in respinse to each client connection
So here is my client
I have a test class for the server (below). I then start the server running and then the client
What I want is for my program to remain inside the while loop simply waiting for a new client message to be sent but as it is, it reads the messages sent and then an exception is thrown. I thought it was best to post my code. Hope someone can shed some light on this please as I really want to get my head around sockets...the basics at least.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Why is my connection reset on this test program?