Hello everyone, this is my first time uploading here, so please be gentle :P I am writing the code for a server-client program that exchanges messages and the server asks the client for some information. Although the code works, when I run the program and it asks from the client to enter an Integer, it requires for the integer to be entered twice before it is accepted and I can see no obvious reason why this is happening. Could someone enlighten me?
The console output for the client is this:
The client is connected to: IliasGk-PC/192.168.1.5 on port: 13000
Please enter your name here:
Server says: Selling IliasGk-PC/192.168.1.5
Server says: Type 'Catalogue' to see the available products or 'Bid' to make an offer.
Server says: If you want to terminate the connection at any time, please type 'EXIT'
Server says: Which item are you interested in buying?
Server says: Please select by an integer ID
Server says: You have selected: LG G2
Server says: Please enter your bid:
Server says: Your bid is accepted. Enjoy your new phone.
Server says: Your connection will now be terminated. Thank you for buying our product.
Thank you very much for the welcome and for the reply The "interesting" thing is that there is no Exception thrown on the Server's side or anything and I just figured out that the first time the input is given, it is passed on to the server as a simple message and not as an int i variable... Server's output for the mentioned "conversation" is:
The server is up.
Connection established. Client number: 1
Client '1' says: 1
Client '1' says: 300
I've been trying to troubleshoot this for a few days and it's driving me insane :P