I have some simple client and server code, where the client sends some bytes to the server, and the server responds with some bytes. The client prints the received bytes, and then closes the socket.
This works fine the first time the client runs, but subsequent calls get no response.
The Bentley Status Dashboard provides users with the current state of our Cloud and CONNECT Services. If a Service doesn't appear to be working users should check this page to verify that the service is operational.
Server code
Would be grateful for any comments regarding why this is the case. Thank you.
Stephen BentleyStephen Bentley
1 Answer
A few things:
This block of code will loop forever until after the client closes his connection:
Then after the client closes his connection, the subsequent attempt to send 'HELLO CLIENT' to the socket will generate an IO exception. That will trigger your server loop to exit.
The easy fix is to adjust your protocol such that the 'message' is completed on some sentinel char. In my easy fix, I just adjusted it to break out when a ! was received.
Better to have each client session terminate on an ioexception instead of the entire server block. My refactor of your code:
Not the answer you're looking for? Browse other questions tagged javasocketstcp or ask your own question.
CONNECT Technology
CONNECT Technology
I just installed the latest version of STAAD.Pro and it is now 'CONNECT Enabled'. We're getting less enchanted with Bentley and are pulling back from it so STAAD is the only Bentley product we use with any regularity. I don't want to log on to CONNECT until I understand just what is going to be happening 'behind the scenes'. Since we don't deal with a lot of Bentley products and don't really need to share info via Bentley apps I'm not sure I see the value. Has anyone tried it? What are your thoughts?