added #defines for win32
This commit is contained in:
parent
964be91fa9
commit
ce6068b65a
|
@ -1761,7 +1761,13 @@ float Socket::getAveragePingMS(std::string host, int pingCount) {
|
|||
sprintf(szCmd,"ping -c %d %s",pingCount,host.c_str());
|
||||
#endif
|
||||
if(szCmd[0] != '\0') {
|
||||
#ifdef _popen
|
||||
FILE *ping= _popen(szCmd, "r");
|
||||
#elif defined popen
|
||||
FILE *ping= popen(szCmd, "r");
|
||||
#else
|
||||
FILE *ping=NULL;
|
||||
#endif
|
||||
if (ping != NULL){
|
||||
char buf[4000]="";
|
||||
int bufferPos = 0;
|
||||
|
@ -1769,7 +1775,11 @@ float Socket::getAveragePingMS(std::string host, int pingCount) {
|
|||
char *data = fgets(&buf[bufferPos], 256, ping);
|
||||
bufferPos = strlen(buf);
|
||||
}
|
||||
#ifdef _pclose
|
||||
_pclose(ping);
|
||||
#elif defined popen
|
||||
pclose(ping);
|
||||
#endif
|
||||
|
||||
if(debugPingOutput) printf("Running cmd [%s] got [%s]\n",szCmd,buf);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user