loop until all bytes are written in TCPConnection::write, updated gcore