mirror of
https://github.com/glest/glest-source.git
synced 2025-08-17 13:50:43 +02:00
added #defines for win32
This commit is contained in:
@@ -1761,7 +1761,13 @@ float Socket::getAveragePingMS(std::string host, int pingCount) {
|
|||||||
sprintf(szCmd,"ping -c %d %s",pingCount,host.c_str());
|
sprintf(szCmd,"ping -c %d %s",pingCount,host.c_str());
|
||||||
#endif
|
#endif
|
||||||
if(szCmd[0] != '\0') {
|
if(szCmd[0] != '\0') {
|
||||||
|
#ifdef _popen
|
||||||
|
FILE *ping= _popen(szCmd, "r");
|
||||||
|
#elif defined popen
|
||||||
FILE *ping= popen(szCmd, "r");
|
FILE *ping= popen(szCmd, "r");
|
||||||
|
#else
|
||||||
|
FILE *ping=NULL;
|
||||||
|
#endif
|
||||||
if (ping != NULL){
|
if (ping != NULL){
|
||||||
char buf[4000]="";
|
char buf[4000]="";
|
||||||
int bufferPos = 0;
|
int bufferPos = 0;
|
||||||
@@ -1769,7 +1775,11 @@ float Socket::getAveragePingMS(std::string host, int pingCount) {
|
|||||||
char *data = fgets(&buf[bufferPos], 256, ping);
|
char *data = fgets(&buf[bufferPos], 256, ping);
|
||||||
bufferPos = strlen(buf);
|
bufferPos = strlen(buf);
|
||||||
}
|
}
|
||||||
|
#ifdef _pclose
|
||||||
|
_pclose(ping);
|
||||||
|
#elif defined popen
|
||||||
pclose(ping);
|
pclose(ping);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(debugPingOutput) printf("Running cmd [%s] got [%s]\n",szCmd,buf);
|
if(debugPingOutput) printf("Running cmd [%s] got [%s]\n",szCmd,buf);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user