This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | Send (const string &s) |
int | Send (const char *msg, int len) |
bool | InitializeCommunications (string hostname, int port) |
This initializes communications with the server. More... | |
void | ShutdownCommunications () |
Shutdown the communications, close the sockets, etc. More... | |
bool | IsConnected () |
Determines if the client is connected to the server. More... | |
void | RecordPacket (unsigned long packetsize) |
|
This initializes communications with the server.
Definition at line 148 of file communication.cpp. Referenced by BackgroundThread().
00149 { 00150 #ifdef WIN32 00151 WORD wVersionRequested; 00152 WSADATA wsaData; 00153 int err; 00154 00155 wVersionRequested = MAKEWORD( 1, 1 ); 00156 00157 err = WSAStartup( wVersionRequested, &wsaData ); 00158 if ( err != 0 ) { 00159 debug("WSA error", WSAGetLastError()); 00160 Server = -1; 00161 return false; 00162 } 00163 #endif 00164 00165 Server = GetSocketDescriptor(hostname.c_str(), static_cast<unsigned short>(port)); 00166 if (IsConnected()) 00167 debug("connected!"); 00168 else 00169 debug("couldn't connect"); 00170 return IsConnected(); 00171 } |
|
Determines if the client is connected to the server.
Definition at line 79 of file communication.cpp. 00080 { 00081 return (Server > 0); 00082 } |
|
Definition at line 176 of file communication.cpp. Referenced by ThreadDump().
00177 { 00178 ++PacketCount; 00179 PacketBytes += packetsize; 00180 } |
|
Referenced by Send(), ShutdownCommunications(), and ThreadDump().
|
|
|
|
Shutdown the communications, close the sockets, etc.
Definition at line 185 of file communication.cpp. 00186 { 00187 Send("/*done*/"); 00188 unsafe_debug("Bytes sent:", BytesSent); 00189 unsafe_debug("SendCalls: ", SendCalls); 00190 //fprintf(stderr, "bytes=%d calls=%d\n", BytesSent, SendCalls); 00191 fprintf(stdout, "\npackets\tbytes\trefresh\n"); 00192 //fprintf(stderr, "packets\t%d \nbytes\t%d\nrefresh\t%d\n", PacketCount, PacketBytes,RefreshTime); 00193 fprintf(stdout, "%d\t%d\t%d\n", PacketCount, PacketBytes,RefreshTime); 00194 00195 fprintf(stdout, "Methods=%d, Classes=%d, MethodCache=%d,ClassCache=%d\n", Methods.size(), Classes.size(), MethodCache.size(), ClassCache.size()); 00196 00197 fflush(stdout); 00198 unsafe_debug("Average: ", BytesSent / static_cast<double>(SendCalls)); 00199 if (Server > 0) 00200 closesocket(Server); 00201 Server = -1; 00202 #ifdef WIN32 00203 WSACleanup(); 00204 #endif 00205 } |