add flush at port opening
add exit command to close program gracefully
log responses sent by the server