modified tcp protocol handling and packet serialization