diff options
author | Stijn Buys <ingar@osirion.org> | 2008-03-21 19:55:36 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-03-21 19:55:36 +0000 |
commit | 549f90727d321cd6cf8850e8b510beba36925a82 (patch) | |
tree | d70b87c62584cad4b372179fae99a6ac9deffdf0 /src/core/netclient.cc | |
parent | a57ced5458db5f400aa6f813bd977279de0b9ea3 (diff) |
minor updates
Diffstat (limited to 'src/core/netclient.cc')
-rw-r--r-- | src/core/netclient.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/netclient.cc b/src/core/netclient.cc index 32e0f4b..dba6e2b 100644 --- a/src/core/netclient.cc +++ b/src/core/netclient.cc @@ -22,7 +22,7 @@ NetClient::NetClient(std::string host, int port) : con_print << host << ":" << port << " connects." << std::endl; // Get a socket file descriptor - client_fd = socket(PF_INET, SOCK_DGRAM, 0); + client_fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); if (client_fd == -1) { con_warn << "Network client socket() failed!" << std::endl; abort(); @@ -45,7 +45,7 @@ NetClient::NetClient(std::string host, int port) : std::ostringstream osstream; client_player.player_id = client_fd; - sendq.erase(); + sendq.clear(); messageblock.clear(); client_error = false; @@ -105,14 +105,14 @@ void NetClient::receive(char *data) // TODO detect "begin binary block" message for zlib compression if (messageblock.size() > 0 ) { recvq.push_back(messageblock); - messageblock.erase(); + messageblock.clear(); } } else { if (messageblock.size() < FRAMESIZE) { messageblock.append(datablock.substr(0,1)); } else { con_warn << "Incoming message exceeds " << FRAMESIZE << " bytes!\n"; - messageblock.erase(); + messageblock.clear(); } } datablock.erase(0,1); |