The server closes the connection after sending its response.
Your protocol is not working. Your server accepts a new connection, reads from it, writes to it, then closes it. Your client creates a new connection, writes to it, reads from it, and then expects it to remain open.
I see two options:
1) in the server, keep the connection open. You will need a new
thread that keeps reading from and writing to the connection, or you will block new connections.
2) in the client, don't store the socket and the streams globally, but reconnect and recreate the streams when pressing the button only.