Changeset 174
- Timestamp:
- 03/21/09 17:06:46 (15 years ago)
- Location:
- vtcross/trunk/src
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/trunk/src/include/vtcross/socketcomm.h
r170 r174 26 26 /* TODO 27 27 */ 28 int32_t SendMessage(int32_t socketFD, char* message); 28 //int32_t SendMessage(int32_t socketFD, char* message); 29 int32_t SendMessage(int32_t socketFD, const char* message) ; 29 30 30 31 -
vtcross/trunk/src/lib/socketcomm/socketcomm.cpp
r173 r174 14 14 #include <netinet/in.h> 15 15 #include <stdint.h> 16 #include <string> 16 17 #include <sys/types.h> 17 18 #include <sys/socket.h> … … 75 76 76 77 78 /* 77 79 int32_t 78 80 SendMessage(int32_t socketFD, char* message) … … 83 85 strcat(message, "\0000"); 84 86 87 ssize_t numSentBytes = send(socketFD, message, (strlen(message) + 1), 0); 88 if(numSentBytes < 0) { 89 ERROR(1, "Error sending to server."); 90 } 91 else if(numSentBytes == 0) { 92 LOG("socket_comm::SendMessage - Server closed the socket.\n"); 93 } 94 95 return numSentBytes; 96 } 97 */ 98 99 // TODO this function is here to handle calls to send const char* messages. Note 100 // that the std::string.c_str() function auto-appends a null character at the 101 // end of the cstring, so the strcat function call in the previous function 102 // isn't necessary here... I think... although I still don't really understand 103 // what exactly that call is for. 104 int32_t 105 SendMessage(int32_t socketFD, const char* message) 106 { 85 107 ssize_t numSentBytes = send(socketFD, message, (strlen(message) + 1), 0); 86 108 if(numSentBytes < 0) {