Hello,
I almost finish my project. I am working on the final
testing right now. The design choice I chose is socket. It works fine while I used the Swing GUI client to perform the actions: e.g. bookSeat and search. In order to test my lock/unlock mechanism, I have a small bench program to run against with the multi-threaded server. The small bench program simply connect to the server and book record 1 by one seat. I use a for loop to spawn 5 threads to connect the server to perform the book seat
action. But sometimes I got the error messages:
Connection reset by peer: JVM_recv in socket input stream read
java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
The design of my multi-thread server is as follows:
while(true)
{
Socket incoming = serverSocket.accept() ;
new
Thread(new handle(incoming)).start() ;
}
As long as there's a new request incoming, the program spawns a new thread to handle the request (it means all the process would be in the run() method). I really can't figure out what the problem. If someone is also using the Socket approach, could you please give me some suggestions or advise? Thank you very much!!
Best Regards,
-PRELUDE