Added code to check if connection is established before writing
Added code to store flag in function parameter
Revert 7757f92862e841fd3f7a79ce7559c9463815be4b
Added handle_packet() function
Added tcp_read() function