当前位置: 首页>>代码示例>>C++>>正文


C++ ping函数代码示例

本文整理汇总了C++中ping函数的典型用法代码示例。如果您正苦于以下问题:C++ ping函数的具体用法?C++ ping怎么用?C++ ping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ping函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parse_options


//.........这里部分代码省略.........
		{ "getfiledetailsbyid", optional_argument, NULL, OPT_GETFILEDETAILSBYID },

                /* Get file id */
		{ "getfileid",          required_argument, NULL, OPT_GETFILEID },

                /* Get file */
		{ "getfile",            required_argument, NULL, OPT_GETFILE },

                /* Get file by id */
		{ "getfilebyid",        required_argument, NULL, OPT_GETFILEBYID },

		/* Get all files */
		{ "getallfiles",        required_argument, NULL, OPT_GETALLFILES },

                /* Put a file */
		{ "putfile",            required_argument, NULL, OPT_PUTFILE },

		/* Delete a file */
		{ "deletefile",         required_argument, NULL, OPT_DELETEFILE },

		/* Delete a file by id */
		{ "deletefilebyid",     required_argument, NULL, OPT_DELETEFILEBYID },

		/* Shell like interface */
		{ "shell",              no_argument, NULL, OPT_SHELL },

		/* Get MMS message mode */
		{ "getmms",             required_argument, NULL, OPT_GETMMS },

		/* Delete MMS message mode */
		{ "deletemms",          required_argument, NULL, OPT_DELETEMMS },

		/* Check if the phone responds */
		{ "ping",               no_argument, NULL, OPT_PING },

		{ 0, 0, 0, 0 },
	};

	/* Every command which requires arguments should have an appropriate entry
	   in this array. */
	static struct gnokii_arg_len gals[] = {
		{ OPT_HELP,              1, 100, 0 },
		{ OPT_CONFIGFILE,        1, 100, 0 },
		{ OPT_CONFIGMODEL,       1, 100, 0 },
		{ OPT_ENTERSECURITYCODE, 1, 100, 0 },
		{ OPT_CHANGESECURITYCODE,1, 1, 0 },
		{ OPT_SETDATETIME,       0, 5, 0 },
		{ OPT_SETALARM,          0, 2, 0 },
		{ OPT_DIALVOICE,         1, 1, 0 },
		{ OPT_ANSWERCALL,        1, 1, 0 },
		{ OPT_HANGUP,            1, 1, 0 },
		{ OPT_GETTODO,           1, 3, 0 },
		{ OPT_WRITETODO,         2, 3, 0 },
		{ OPT_GETCALENDARNOTE,   1, 3, 0 },
		{ OPT_WRITECALENDARNOTE, 2, 3, 0 },
		{ OPT_DELCALENDARNOTE,   1, 2, 0 },
		{ OPT_GETPHONEBOOK,      2, 4, 0 },
		{ OPT_WRITEPHONEBOOK,    0, 10, 0 },
		{ OPT_DELETEPHONEBOOK,   2, 3, 0 },
		{ OPT_GETSPEEDDIAL,      1, 1, 0 },
		{ OPT_SETSPEEDDIAL,      3, 3, 0 },
		{ OPT_CREATESMSFOLDER,   1, 1, 0 },
		{ OPT_DELETESMSFOLDER,   1, 1, 0 },
		{ OPT_GETSMS,            2, 6, 0 },
		{ OPT_DELETESMS,         2, 3, 0 },
		{ OPT_SENDSMS,           1, 10, 0 },
开发者ID:tal-nino,项目名称:gnokii,代码行数:67,代码来源:gnokii.c

示例2: select


//.........这里部分代码省略.........
            server.sin_family = AF_INET;
            server.sin_addr.s_addr = htonl(INADDR_ANY);
            server.sin_port = htons(0);
            bind(sd, (sockaddr*)&server, sizeof(server));
            listen(sd, 5);
            //sockaddr_in tcpserver = {};
            //socklen_t sz = sizeof(tcpserver);

            //calculam expresia regulata
            input.erase(input.begin(), input.begin()+strlen("search"));
            stringStrip(input);
            printf("[Search] %s %s\n", input.c_str(), uuid);
            uuids[uuid] = getTicks();
            comm.push_back(MSG_request);
            comm.push_back(sizeof(sd), &sd);
            commands.push_back(comm);
            //trimit la toti peeri mesajul
            for (list<Peer>::iterator it=peers.begin(); it!=peers.end(); ++it){
                int ip=getIP(sd);
                unsigned short port=getPort(sd);

                msg.clear();
                msg.push_back(MSG_search);
                msg.push_back(40, uuid);
                msg.push_back(sizeof(ip), &ip);
                msg.push_back(sizeof(port), &port);
                msg.push_back(input.size(), input.c_str());

                sendto(udpsd, msg.getMessage(), msg.getSize(), 0, (sockaddr*)&it->address, sizeof(it->address));
            }
        }
        else{
        }
    }
    for (int d=3; d<=nfds; ++d){
        if (FD_ISSET(d, &errorfds)){
        }
        if (FD_ISSET(d, &readfds)){
            if (d==udpsd){
                MSG msgType;
                char ipString[40];
                int port, size;

                socklen_t sock_size = sizeof(client);
                if ((size=recvfrom(d, msgBuffer, 100, 0, (sockaddr*)&client, &sock_size))<=0){
                    printf("Clientul s-a inchis");
                    continue;
                }

                Message msg(size, msgBuffer);
                msg.pop_front(msgType);
                switch (msgType){
                    case MSG_connectAsServer:
                        printf("[server] Connection request P2P_connectAsServer\n");
                        serverPeers.push_back(client);
                    case MSG_connectAsPeer:
                        inet_ntop(client.sin_family, &client.sin_addr.s_addr, ipString, sizeof(ipString));
                        port = client.sin_port;
                        printf("[server] Connection request\n");
                        printf("[server] S-a conectat un peer %s %d\n", ipString, port);
                        peers.push_back(client);
                        sock_size = sizeof(client);
                        msg.clear();
                        msg.push_back(MSG_connectedOK);
                        sendto(udpsd, msg.getMessage(), msg.getSize(), 0, (sockaddr*)&client, sock_size);
                        ///inainte de push verificam sa nu fie in lista (nu e deja peer)
                        printf("[server] Numar total de conexiuni: %lu\n", peers.size());
                        break;
                    case MSG_pong:
                        inet_ntop(client.sin_family, &client.sin_addr.s_addr, ipString, sizeof(ipString));
                        port = client.sin_port;
                        for (list<Peer>::iterator it=peers.begin(); it!=peers.end(); ++it){
                            if (!memcmp(&it->address, &client, sizeof(it->address))){
                                ///client a raspuns la ping
                                printf("[server] Pong from %s %d\n", ipString, port);
                                it->lastPong = getTicks();
                                it->tries = 0;
                                break;
                            }
                        }
                        break;
                    case MSG_search:
                        commands.push_back(msg);
                        for (list<Peer>::iterator it=peers.begin(); it!=peers.end(); ++it){
                            sendto(udpsd, msg.getMessage(), msg.getSize(), 0, (sockaddr*)&it->address, sizeof(it->address));
                        }
                        break;
                    default:
                        printf("[server] Wrong option\n");
                }
            }
            else{
            }
        }
        if (FD_ISSET(d, &writefds)){
        }
    }
    ping();
    return 0; //maybe return value is not needed
}
开发者ID:berendeanicolae,项目名称:P2P,代码行数:101,代码来源:Server.cpp

示例3: remap

/*
 * Rtt_tol is the fractional tollerance for RTT comparisons.
 * If a later (further down the list) host's RTT is less than
 * 1/Rtt_tol better than my current best then I don't bother
 * with it.  This biases me towards entries at the top of the list
 * which Active Directory has already chosen for me and prevents
 * noise in RTTs from pushing me to more distant machines.
 */
static int
remap(Dfscache *cp, Refer *re)
{
	int n;
	long rtt;
	char *p, *a[4];
	enum {
		Hostname = 1,
		Sharename = 2,
		Pathname = 3,

		Rtt_tol = 10
	};

	if(Debug && strstr(Debug, "dfs") != nil)
		print("	remap %s\n", re->addr);

	for(p = re->addr; *p; p++)
		if(*p == '\\')
			*p = '/';

	if(cp->prox < re->prox){
		if(Debug && strstr(Debug, "dfs") != nil)
			print("	remap %d < %d\n", cp->prox, re->prox);
		return -1;
	}
	if((n = getfields(re->addr, a, sizeof(a), 0, "/")) < 3){
		if(Debug && strstr(Debug, "dfs") != nil)
			print("	remap nfields=%d\n", n);
		return -1;
	}
	if((rtt = ping(a[Hostname], Dfstout)) == -1){
		if(Debug && strstr(Debug, "dfs") != nil)
			print("	remap ping failed\n");
		return -1;
	}
	if(cp->rtt < rtt && (rtt/labs(rtt-cp->rtt)) < Rtt_tol){
		if(Debug && strstr(Debug, "dfs") != nil)
			print("	remap bad ping %ld < %ld && %ld < %d\n",
				cp->rtt, rtt, (rtt/labs(rtt-cp->rtt)), Rtt_tol);
		return -1;
	}

	if(n < 4)
		a[Pathname] = "";
	if(re->ttl == 0)
		re->ttl = 60*5;

	free(cp->host);
	free(cp->share);
	free(cp->path);
	cp->rtt = rtt;
	cp->prox = re->prox;
	cp->expiry = time(nil)+re->ttl;
	cp->host = estrdup9p(a[Hostname]);
	cp->share = estrdup9p(trimshare(a[Sharename]));
	cp->path = estrdup9p(a[Pathname]);
	if(Debug && strstr(Debug, "dfs") != nil)
		print("	remap ping OK prox=%d host=%s share=%s path=%s\n",
			cp->prox, cp->host, cp->share, cp->path);
	return 0;
}
开发者ID:99years,项目名称:plan9,代码行数:70,代码来源:dfs.c

示例4: ping

RawBot::msg_vector RawBot::OnError(const jsoncons::json& msg) {
  const auto& data = msg.get("data", jsoncons::json(""));
  std::cout << "Server: Error - " << data.to_string() << std::endl;
  return ping();
}
开发者ID:joechin91,项目名称:helloworldopen2014,代码行数:5,代码来源:raw_bot.cpp

示例5: switch

void Servotor32::processChar(char inChar){
  switch(inChar){
    case '#':
      servoCounting = true;
      numCount = 0;
      inServo = -1;
      inPos = -1;
      break;
    case 'D':
      printStatus();
      break; 
    case 'P':
      if(servoCounting){
        inServo = tallyCount();
        servoCounting = false;
      }
      posCounting =  true;
      numCount = 0;
      break; 
    case '\r':
    case '\n':
      if(posCounting){
        inPos = tallyCount();
        posCounting = false;
      }
      if((inServo >=0)&&(inServo <=31)&&(((inPos >= 500)&&(inPos <= 2500))||(inPos == -1))){
        changeServo(inServo,inPos);        
        inServo = -1;
        inPos = -1;
      }
      numCount = 0;
      break;
    case 'V':
      Serial.println("SERVOTOR32_v2.0");
      Serial1.println("SERVOTOR32_v2.0");
      break;
    case 'C':
      for(int i=0; i<32; i++){
        changeServo(i, 1500);
      }
      Serial.println("All Centered");
      Serial1.println("All Centered");
      break;
    case 'K':
      for(int i=0; i<32; i++){
        changeServo(i,-1);
      }
      Serial.println("All Turned Off");
      Serial1.println("All Turned Off");
      break;
    case 'L':
      if(servoCounting){
        inServo = tallyCount();
        servoCounting = false;
      }
      changeServo(inServo, -1);
      break;
    case 'Q':
      Serial.print("CM: ");
      Serial.println(ping());
      Serial1.print("CM: ");
      Serial1.println(multiPing(10));
    default:
      if((inChar > 47)&&(inChar < 58)){
        if(numCount<4){
          numString[numCount] = inChar-48;
          numCount++;
        }
      }
      break;
  } 
}
开发者ID:LingDar,项目名称:Hexy,代码行数:72,代码来源:Servotor32.cpp

示例6: while

void Framework::loop()
{
	/* main loop variable */
	bool done = false;
	/* used to collect events */
	SDL_Event event;

	/* wait for events */
	while (!done)
	{
		/* handle the events in the queue */
		while (SDL_PollEvent(&event))
		{
			switch(event.type)
			{
			case SDL_MOUSEMOTION:
				/* give away mouse movement with buttons pressed */
				handleMouseMove(event.motion.xrel, event.motion.yrel, event.motion.state);
				break;
			case SDL_MOUSEBUTTONUP:
				/* handle mouse button release for serving */
				if (event.button.button == SDL_BUTTON_LEFT)
					if (!paused) serveBall();
			case SDL_KEYDOWN:
				/* handle key presses */
				handleKeyPress(&event.key.keysym);
				break;
			case SDL_QUIT:
				/* handle quit requests */
				done = true;
				break;
			case SDL_USEREVENT:
				if (((TimerData*)event.user.data1)->timer == NULL)
				{
					/* this means our timer has gone inactive and we are pleased to stop our work! */
				} else {
					((TimerData*)event.user.data1)->receiver->action(((TimerData*)event.user.data1)->event);
				}
				break;
			}
		}
		int tdiff = SDL_GetTicks() - lasttime;
		if (tdiff > timeunit) {
			frames++;
			xdiff += tdiff; // always greater 0 because we decided to let tdiff be greater than timeunit
			if ((xdiff >= 500)&&(xdiff >= timeunit * 25)) {
				output.updateFPS(frames * 1000.0 / xdiff); // There are 1000 ticks / second
				frames = 0;
				xdiff = 0;
				ping();
			}
			lasttime += tdiff;

			// Multiplayer code
			doNetworking();

			// Game status code
			updateGame(tdiff);

			// Rendering code
			drawScene();
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:pong2-svn,代码行数:64,代码来源:Framework.cpp

示例7: main

int main(int argc, char *argv[])
{
    if(argc < 2)
    {
        fprintf(stderr, "Invalid arguments. Usage: %s <interface>\n", argv[0]);
        return -1;
    }
    struct hostent *hname;
    struct sockaddr_in addr;

    int pid;
    struct protoent *proto;
    char ip_prefix[20],ipadd[20];
    //gets ip prefix for e.g. if ip is 172.17.14.10, below function will return 172.17.14.
    getip_prefix(getip(argv[1]),ip_prefix);
    int i,j;

    char str[3];

    //Check for root permissions
    if(getuid()!=0)
    {
        perror("Root permissions are required to run the program\n");
        exit(-1);
    }

    //Creating shared memory for storing the icmp response for the requested ip. Host part of the ip would be used
    //as array index.
    int shmid;
    shmid=shmget(IPC_PRIVATE,255*sizeof(int),0);
    shmarr=(int *)shmat(shmid,NULL,0);

    //fill the array with some value other than 0 as icmp response type which would be stored in the array
    // would be zero.
    initialize(shmarr);

    printf("Scanning online hosts\n");

    for(i=1;i<MAXHOSTS;i++)
    {
        //Will ping all the host ips in different processes to speed up.
        if(fork()==0)
        {
            bzero(ipadd,20);
            bzero(str,3);

            sprintf(str,"%d",i);
            strcpy(ipadd,ip_prefix);

            int t=(int)strlen(ip_prefix);

            //Creating host ip address by appending host part to the ip prefix.
            for(j=0;j<strlen(str);j++)
                ipadd[t+j]=str[j];

            //pid required for icmp id
            pid = getpid();
            proto = getprotobyname("ICMP");
            hname = gethostbyname(ipadd);

            bzero(&addr, sizeof(addr));
            addr.sin_family = (sa_family_t )hname->h_addrtype;
            addr.sin_port = 0;
            addr.sin_addr.s_addr = (in_addr_t )*(long*)hname->h_addr;

            //now ping the host.
            ping(&addr,pid,proto);
            exit(0);
        }
        else
        {
            // if(i%100==0)
            // 	sleep(10);
            continue;
        }
    }
    //make parent sleep
    sleep(10);

    printf("Online hosts\n");
    int ct=0;

    for(i=1;i<MAXHOSTS;i++)
    {
        if(shmarr[i]==0)
        {
            printf("%s%d\n",ip_prefix,i );
            ct++;
        }
    }
    printf("Total %d hosts online\n",ct);

    //wait for all the childs to exit
    wait(0);

    return 0;
}
开发者ID:anchitjain1234,项目名称:Online-Hosts-Scanner,代码行数:97,代码来源:main.c

示例8: libcfs_ioctl_int

static int libcfs_ioctl_int(struct cfs_psdev_file *pfile,unsigned long cmd,
                            void *arg, struct libcfs_ioctl_data *data)
{
        int err = -EINVAL;
        ENTRY;

        switch (cmd) {
        case IOC_LIBCFS_CLEAR_DEBUG:
                libcfs_debug_clear_buffer();
                RETURN(0);
        /*
         * case IOC_LIBCFS_PANIC:
         * Handled in arch/cfs_module.c
         */
        case IOC_LIBCFS_MARK_DEBUG:
                if (data->ioc_inlbuf1 == NULL ||
                    data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0')
                        RETURN(-EINVAL);
                libcfs_debug_mark_buffer(data->ioc_inlbuf1);
                RETURN(0);
#if LWT_SUPPORT
        case IOC_LIBCFS_LWT_CONTROL:
                err = lwt_control ((data->ioc_flags & 1) != 0, 
                                   (data->ioc_flags & 2) != 0);
                break;

        case IOC_LIBCFS_LWT_SNAPSHOT: {
                cfs_cycles_t   now;
                int            ncpu;
                int            total_size;

                err = lwt_snapshot (&now, &ncpu, &total_size,
                                    data->ioc_pbuf1, data->ioc_plen1);
                data->ioc_u64[0] = now;
                data->ioc_u32[0] = ncpu;
                data->ioc_u32[1] = total_size;

                /* Hedge against broken user/kernel typedefs (e.g. cycles_t) */
                data->ioc_u32[2] = sizeof(lwt_event_t);
                data->ioc_u32[3] = offsetof(lwt_event_t, lwte_where);

                if (err == 0 &&
                    libcfs_ioctl_popdata(arg, data, sizeof (*data)))
                        err = -EFAULT;
                break;
        }

        case IOC_LIBCFS_LWT_LOOKUP_STRING:
                err = lwt_lookup_string (&data->ioc_count, data->ioc_pbuf1,
                                         data->ioc_pbuf2, data->ioc_plen2);
                if (err == 0 &&
                    libcfs_ioctl_popdata(arg, data, sizeof (*data)))
                        err = -EFAULT;
                break;
#endif
        case IOC_LIBCFS_MEMHOG:
                if (pfile->private_data == NULL) {
                        err = -EINVAL;
                } else {
                        kportal_memhog_free(pfile->private_data);
                        /* XXX The ioc_flags is not GFP flags now, need to be fixed */
                        err = kportal_memhog_alloc(pfile->private_data,
                                                   data->ioc_count,
                                                   data->ioc_flags);
                        if (err != 0)
                                kportal_memhog_free(pfile->private_data);
                }
                break;

        case IOC_LIBCFS_PING_TEST: {
		extern void (kping_client)(struct libcfs_ioctl_data *);
		void (*ping)(struct libcfs_ioctl_data *);

		CDEBUG(D_IOCTL, "doing %d pings to nid %s (%s)\n",
		       data->ioc_count, libcfs_nid2str(data->ioc_nid),
		       libcfs_nid2str(data->ioc_nid));
		ping = symbol_get(kping_client);
		if (!ping) {
			CERROR("symbol_get failed\n");
		} else {
			ping(data);
			symbol_put(kping_client);
		}
		RETURN(0);
	}

        default: {
                struct libcfs_ioctl_handler *hand;
                err = -EINVAL;
		down_read(&ioctl_list_sem);
                cfs_list_for_each_entry_typed(hand, &ioctl_list,
                        struct libcfs_ioctl_handler, item) {
                        err = hand->handle_ioctl(cmd, data);
                        if (err != -EINVAL) {
                                if (err == 0)
                                        err = libcfs_ioctl_popdata(arg, 
                                                        data, sizeof (*data));
                                break;
                        }
                }
//.........这里部分代码省略.........
开发者ID:walgenbach,项目名称:lustre-release,代码行数:101,代码来源:module.c

示例9: while

    AutoBalanceResult WirelessNode_Impl::autoBalance(const ChannelMask& mask, float targetPercent)
    {
        Utils::checkBounds_min(targetPercent, 0.0f);
        Utils::checkBounds_max(targetPercent, 100.0f);

        //attempt a few pings first 
        //(legacy (v1) autobalance doesn't have a response packet, so need to check communication)
        uint8 retryCounter = 0;
        bool pingSuccess = false;
        while(!pingSuccess && retryCounter < 3)
        {
            pingSuccess = ping().success();
            retryCounter++;
        }

        if(!pingSuccess)
        {
            throw Error_NodeCommunication(nodeAddress());
        }

        //find the eeprom location that the autobalance will adjust
        //Note: this also verifies that it is supported for this mask
        const EepromLocation& eepromLoc = features().findEeprom(WirelessTypes::chSetting_autoBalance, mask);

        //currently, autobalance is always per channel, so get the channel from the mask
        uint8 channelNumber = mask.lastChEnabled();

        AutoBalanceResult result;

        //perform the autobalance command with the parent base station
        m_baseStation.node_autoBalance(protocol(), m_address, channelNumber, targetPercent, result);

        //clear the cache of the hardware offset eeprom location we adjusted
        eeprom().clearCacheLocation(eepromLoc.location());

        Utils::threadSleep(200);

        //if we used the legacy command, we don't get result info, need to do more work to get it
        if(result.m_errorCode == WirelessTypes::autobalance_legacyNone)
        {
            result.m_errorCode = WirelessTypes::autobalance_maybeInvalid;

            //force the read eeprom retries to a minimum of 3
            uint8 startRetries = m_eepromSettings.numRetries;

            //when this goes out of scope, it will change back the original retries value
            ScopeHelper writebackRetries(std::bind(&WirelessNode_Impl::setReadWriteRetries, this, startRetries));

            //if there are less than 10 retries
            if(startRetries < 10)
            {
                //we want to retry at least a few times
                setReadWriteRetries(10);
            }
            else
            {
                //don't need to write back the retries since we didn't make a change
                writebackRetries.cancel();
            }

            //read the updated hardware offset from the node
            result.m_hardwareOffset = readEeprom(eepromLoc).as_uint16();

            bool readSensorSuccess = false;

            uint8 readSensorTry = 0;
            do
            {
                //perform the read single sensor command
                uint16 sensorVal = 0;
                readSensorSuccess = m_baseStation.node_readSingleSensor(m_address, channelNumber, sensorVal);

                if(readSensorSuccess)
                {
                    //find the max bits value of the node
                    uint32 maxBitsVal = 0;
                    switch(model())
                    {
                        case WirelessModels::node_vLink:
                        case WirelessModels::node_sgLink_rgd:
                        case WirelessModels::node_shmLink:
                            maxBitsVal = 65536;
                            break;

                        default:
                            maxBitsVal = 4096;
                            break;
                    }

                    //calculate and store the percent achieved
                    result.m_percentAchieved = static_cast<float>(sensorVal) / static_cast<float>(maxBitsVal) * 100.0f;
                }

                readSensorTry++;
            }
            while(!readSensorSuccess && readSensorTry <= 3);

            if(readSensorSuccess)
            {
                //mark as questionable if not close enough to the target percentage
//.........这里部分代码省略.........
开发者ID:crosvera,项目名称:MSCL,代码行数:101,代码来源:WirelessNode_Impl.cpp

示例10: parasol


//.........这里部分代码省略.........
	usage();
    if (sameString(subType, "sick"))
	{
        clearSickBatch();
	}
    else
        usage();
    }
else if (sameString(command, "check"))
    {
    if (argc != 1)
	usage();
    if (sameString(subType, "dead"))
	{
        checkDeadNodesASAP();
	}
    else
        usage();
    }
else if (sameString(command, "remove"))
    {
    if (argc < 2)
        usage();
    if (sameString(subType, "machine"))
	{
	if (argc < 3)
	    usage();
        removeMachine(argv[1],argv[2]);
	}
    else if (sameString(subType, "job"))
        removeJob(argv[1]);
    else if (sameString(subType, "jobs"))
        removeUserJobs(argv[1], argc-2, argv+2);
    else
        usage();
    }
else if (sameString(command, "list"))
    {
    if (argc != 1)
        usage();
    if (sameString(subType, "machine") || sameString(subType, "machines"))
        hubCommandAndPrint("listMachines");
    else if (sameString(subType, "job") || sameString(subType, "jobs"))
	{
        if (optionExists("extended"))
	    hubCommandAndPrint("listJobsExtended");
        else
	    hubCommandAndPrint("listJobs");
	}
    else if (sameString(subType, "user") || sameString(subType, "users"))
        hubCommandAndPrint("listUsers");
    else if (sameString(subType, "batch") || sameString(subType, "batches"))
        hubCommandAndPrint("listBatches");
    else if (sameString(subType, "sick"))
        hubCommandAndPrint("listSick");
    else
        usage();
    }
else if (sameString(command, "pstat"))
    {
    pstat();
    }
else if (sameString(command, "pstat2"))
    {
    pstat2();
    }
else if (sameString(command, "plan"))
    {
    hubCommandAndPrint("plan");
    }
else if (sameString(command, "ping"))
    {
    int count = 1;
    if (argc >= 1)
        {
	if (!isdigit(argv[0][0]))
	    usage();
	count = atoi(argv[0]);
	}
    ping(count);
    }
else if (sameString(command, "status"))
    status();
else if (sameString(command, "flushResults"))
    {
    if (argc != 0)
        usage();
    flushResults();
    }
/* Not providing at this time for fear of abuse 
else if (sameString(command, "freeBatch"))
    {
    if (argc != 0)
        usage();
    freeBatch();
    }
*/
else
    usage();
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:101,代码来源:parasol.c

示例11: ping

unsigned int SRF08::getDistance(){
	return ping();
}
开发者ID:rafafloripa,项目名称:OpenDaVINCI,代码行数:3,代码来源:SRF08.cpp

示例12: ping

bool TransportObjectFactory::validateObject(const InetSocketAddress& /*address*/, TcpTransport& transport) {
    return ping(transport) == SUCCESS;
}
开发者ID:danberindei,项目名称:cpp-client,代码行数:3,代码来源:TransportObjectFactory.cpp

示例13: ping

void CAdministrationWindow::ping()
{
  ping(mysql());
}
开发者ID:andrewbasterfield,项目名称:mysqlcc,代码行数:4,代码来源:CAdministrationWindow.cpp

示例14: CMyWindow

CAdministrationWindow::CAdministrationWindow(QWidget* parent,  CMySQLServer *m)
: CMyWindow(parent, "CAdministrationWindow")
{
  (void)statusBar();

  blocked = false;
  myApp()->incCritical();
  setCaption("[" + m->connectionName() + "] " + trUtf8("Administration Panel"));
  setIcon(getPixmapIcon("applicationIcon"));
  enableMessageWindow(true);  

  if (!m->oneConnection())
  {
    m_mysql = new CMySQLServer(m->connectionName(), messagePanel());
    m_mysql->connect();
    delete_mysql = true;
  }
  else
  {
    m_mysql = m;  //POSIBLE BUG ... need to make m_mysql redirect messages & errors to this->messagePanel() also.  Currently they are in consoleWindow()
    //probably need to disable the timer !
    delete_mysql = false;
  }

  setCentralWidget( new QWidget( this, "qt_central_widget"));
  CAdministrationWindowLayout = new QGridLayout( centralWidget(), 1, 1, 4, 2, "CAdministrationWindowLayout"); 
  
  tabWidget = new QTabWidget( centralWidget(), "tabWidget");  
  
  processList = new CProcessListTable(tabWidget, m_mysql);
  tabWidget->insertTab(processList, getPixmapIcon("showProcessListIcon"), tr("Process List"), SHOW_PROCESSLIST);

  status = new CServerStatusTable(tabWidget, m_mysql);
  tabWidget->insertTab(status, getPixmapIcon("showStatusIcon"), tr("Status"), SHOW_STATUS);

  variables = new CShowServerVariables(tabWidget, m_mysql);
  tabWidget->insertTab(variables, getPixmapIcon("showVariablesIcon"), tr("Variables"), SHOW_VARIABLES);

  save_menu = new QPopupMenu(this);
  connect(save_menu, SIGNAL(activated(int)), this, SLOT(save(int)));
  save_menu->insertItem(getPixmapIcon("showProcessListIcon"), tr("&Process List"), MENU_SAVE_PROCESSLIST);
  save_menu->insertItem(getPixmapIcon("showStatusIcon"), tr("&Status"), MENU_SAVE_STATUS);
  save_menu->insertItem(getPixmapIcon("showVariablesIcon"), tr("&Variables"), MENU_SAVE_VARIABLES);
  save_menu->insertItem(tr("&InnoDB Status"), MENU_SAVE_INNODB_STATUS);

  has_innodb = CInnoDBStatus::hasInnoDB(m_mysql);
  if (has_innodb)
  {
    innoDBStatus = new CInnoDBStatus(tabWidget, m_mysql);
    tabWidget->insertTab(innoDBStatus, tr("InnoDB Status"), SHOW_INNODB_STATUS);    
  }
  else
    save_menu->setItemEnabled(MENU_SAVE_INNODB_STATUS, false);
  
  CAdministrationWindowLayout->addWidget( tabWidget, 0, 0 );

  viewShowMessagesAction = new CAction (tr("Show Messages"), tr("Show &Messages"), Qt::CTRL + Qt::Key_M,
    this, "fileShowMessagesAction", true);
  viewShowMessagesAction->setParentMenuText(tr("View"));
  connect(viewShowMessagesAction, SIGNAL(toggled(bool)), this, SLOT(showMessages(bool)));
  
  CAction * fileCloseAction = new CAction (tr("Close"), getPixmapIcon("closeIcon"),
    tr("&Close"), 0, this, "fileCloseAction");
  fileCloseAction->setParentMenuText(tr("File"));        
  connect(fileCloseAction, SIGNAL(activated()), this, SLOT(close()));


  fileRefreshAction = new CAction (tr("Refresh"), getPixmapIcon("refreshIcon"),
    tr("&Refresh"), Qt::Key_F5, this, "fileRefreshAction");
  fileRefreshAction->setParentMenuText(tr("File"));
  connect(fileRefreshAction, SIGNAL(activated()), this, SLOT(refresh()));


  actionKillProcessAction = new CAction (tr("Kill Process"), getPixmapIcon("killProcessIcon"),
    tr("&Kill Process"), Qt::CTRL + Qt::Key_K, this, "actionKillProcessAction");
  actionKillProcessAction->setParentMenuText(tr("Action"));
  connect(actionKillProcessAction, SIGNAL(activated()), this, SLOT(killProcesses()));

  CAction * actionPingAction = new CAction (tr("Ping"), getPixmapIcon("pingIcon"),
    tr("&Ping"), Qt::CTRL + Qt::Key_P, this, "actionPingAction");
  actionPingAction->setParentMenuText(tr("Action"));
  connect(actionPingAction, SIGNAL(activated()), this, SLOT(ping()));

  CAction * actionShutdownAction = new CAction (tr("Shutdown"), getPixmapIcon("serverShutdownIcon"),
    tr("&Shutdown"), 0, this, "actionShutdownAction");
  actionShutdownAction->setParentMenuText(tr("Action"));
  connect(actionShutdownAction, SIGNAL(activated()), this, SLOT(shutdown()));

  fileTimerAction = new CAction (tr("Start Refresh Timer"), getPixmapIcon("timerIcon"),
    tr("Start Refresh &Timer"), Qt::CTRL + Qt::Key_T, this, "fileTimerAction", true);
  fileTimerAction->setParentMenuText(tr("File"));
  connect(fileTimerAction, SIGNAL(toggled(bool)), this, SLOT(fileTimerActionToggled(bool)));

  QPopupMenu *fileMenu = new QPopupMenu(this);
  QPopupMenu *actionMenu = new QPopupMenu(this);
  QPopupMenu *viewMenu = new QPopupMenu(this);
  connect(viewMenu, SIGNAL(aboutToShow()), this, SLOT(viewMenuAboutToShow()));

  fileMenu->insertItem(getPixmapIcon("saveIcon"), tr("Save"), save_menu);
  fileMenu->insertSeparator();
//.........这里部分代码省略.........
开发者ID:andrewbasterfield,项目名称:mysqlcc,代码行数:101,代码来源:CAdministrationWindow.cpp

示例15: ping

quint32 VolumeBarLogic::volume ()
{
    ping ();

    return currentvolume;
}
开发者ID:CODeRUS,项目名称:unrestricted-system-ui,代码行数:6,代码来源:volumebarlogic.cpp


注:本文中的ping函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。