Changeset 149 for vtcross/branches
- Timestamp:
- 03/13/09 10:42:47 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/bhilburn/src/include/vtcross/socket_comm.h
r147 r149 11 11 #include <cstdlib> 12 12 #include <cstring> 13 #include <netdb.h> 13 14 #include <netinet/in.h> 14 #include <netdb.h>15 15 #include <stdint.h> 16 16 #include <sys/types.h> … … 25 25 ReadMessage(int32_t socketFD, char* msgBuffer) 26 26 { 27 ssize_t msgLength ;28 29 msgLength = recv(socketFD, msgBuffer, 256, MSG_PEEK);30 for( size_ti = 0; i < 256; i++) {27 ssize_t msgLength = recv(socketFD, msgBuffer, 256, MSG_PEEK); 28 29 size_t i; 30 for(i = 0; i < 256; i++) { 31 31 if(strcmp(&msgBuffer[i], "\0") == 0) 32 32 break; … … 80 80 81 81 ssize_t numSentBytes = send(socketFD, message, (strlen(message) + 1), 0); 82 if(numSentBytes < 0) 83 ERROR("Error sending to server."); 84 else if(numSentBytes == 0) 82 if(numSentBytes < 0) { 83 ERROR(1, "Error sending to server."); 84 } 85 else if(numSentBytes == 0) { 85 86 LOG("socket_comm::SendMessage - Server closed the socket.\n"); 87 } 86 88 87 89 return numSentBytes;