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


C++ setPort函数代码示例

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


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

示例1: setPort

void PortSpace::Release(const Value_t port)
{
	if(port < min_ || port > max_ || IsUsed(port) == false)
		return;

	setPort(port, false);
}
开发者ID:FRC-3637-Daleks,项目名称:dalek-manager-lib,代码行数:7,代码来源:PortSpace.cpp

示例2: query

/// read preference table from sql
void preferences::readDB(){

    if(QFile::exists(DBlocation.c_str())){
        db2 = QSqlDatabase::addDatabase("QSQLITE");
        db2.setDatabaseName(DBlocation.c_str());
        if(db2.open()){
            QSqlQuery query(db2);

            query = QString("SELECT * FROM pref");

            while (query.next()){
                QString QVal1 = query.value(1).toString();
                QString QVal2 = query.value(2).toString();
                QString QVal3 = query.value(3).toString();
                QString QVal4 = query.value(4).toString();
                QString QVal5 = query.value(5).toString();
                QString QVal6 = query.value(6).toString();


                setUser(QVal1.toStdString());
                setPass(QVal2.toStdString());
                setServ(QVal3.toStdString());
                setPort(QVal4.toStdString());
                setTable(QVal5.toStdString());
                setSQL(QVal6.toStdString());
            }
        }

        db2.removeDatabase("QSQLITE");
    }

}
开发者ID:nattakorn4,项目名称:BBB_Project,代码行数:33,代码来源:preferences.cpp

示例3: UnavailablePortError

void PortSpace::Use(const Value_t port)
{
	if(IsUsed(port))
		throw UnavailablePortError(port, *this);

	setPort(port, true);
}
开发者ID:FRC-3637-Daleks,项目名称:dalek-manager-lib,代码行数:7,代码来源:PortSpace.cpp

示例4: mysql_init

// Parameter-Konstruktor
CDatabase_Connection::CDatabase_Connection(string user, string password, string DB, string Host, int Port)
{
    try
    {
        mysql_init(&my);
        LoadDefaults();
        setUsername(user);
        setPassword(password);
        setDB(DB);
        setHost(Host);
        setPort(Port);

        this->connected = false;
        this->initialised = false;



    }
    catch(...)
    {
		cerr << "An unexpected error occured in function 'Default-Constructor'!" << endl;
    }


}
开发者ID:SLCoding,项目名称:SLive,代码行数:26,代码来源:CDatabase_Connection.cpp

示例5: fprintf

void CSensorUSBMotionNodeAccel::closePort()
{
    if (getPort() > -1) {
        fprintf(stdout, "Closing %s sensor port...\n", getTypeStr());
    }
    if (m_node) {
        if (m_node->is_connected() && m_node->is_reading()) {
           m_node->stop();  // if started & reading
        }
        m_node->close();
        delete m_node;
        m_node = NULL;
        setPort();
        setType();
        if (getPort() > -1) {
           fprintf(stdout, "Port closed!\n");
           fflush(stdout);
        }
    }

    // close MN dll
    if (m_WinDLLHandle) {
#ifdef __USE_DLOPEN__
        if (dlclose(m_WinDLLHandle)) {
           fprintf(stderr, "%s: dlclose error %s\n", getTypeStr(), dlerror());
        }
#else // probably Windows - free library
   #ifdef _WIN32
        ::FreeLibrary(m_WinDLLHandle);
   #endif
#endif
	m_WinDLLHandle = NULL;
    }
}
开发者ID:carlgt1,项目名称:qcn,代码行数:34,代码来源:csensor_usb_motionnodeaccel.cpp

示例6: throw

void SocketAddress::set(const char* hostname, int family, uint16_t port)
		throw (UnknownHostException)
{
	int addrLen = 0;

	MX_ASSERT(NULL != hostname);

	if (AF_UNSPEC == family)
	{
		if (!getAddrInfo(hostname, AF_INET6, &data_, &addrLen) && !getAddrInfo(
				hostname, AF_INET, &data_, &addrLen))
		{
			THROW2(UnknownHostException, std::string("Unknown hostname: [") + hostname + "]");
		}
	}
	else
	{
		if (!getAddrInfo(hostname, family, &data_, &addrLen))
		{
			THROW2(UnknownHostException, std::string("Unknown hostname: [") + hostname + "]");
		}
	}

	setPort(port);
}
开发者ID:denofiend,项目名称:code-lib,代码行数:25,代码来源:SocketAddress.cpp

示例7: str

bool IPEndPoint::parse(sal_in_z const char* addressAndPort)
{
	std::string str(addressAndPort);

	// Get position of colon
	size_t pos = str.find(":");

	if (pos != std::string::npos) {
		std::string strIP = str.substr(0, pos);
		if(!mAddress.parse(strIP.c_str()))
			return false;

		// Check existence of port number after colon
		if (str.length() > pos+1) {
			int port;
			if(str2Int(str.substr(pos+1).c_str(), port))
				setPort(uint16_t(port));
			else
				return false;
		}
	} else {
		return mAddress.parse(addressAndPort);
	}

	return true;
}
开发者ID:DrDrake,项目名称:mcore3d,代码行数:26,代码来源:IPEndPoint.cpp

示例8: setPort

 int SimpleRedisClient::redis_conect(const char* Host,int Port, int TimeOut)
 {
     setPort(Port);
     setHost(Host);
     setTimeout(TimeOut);
     return redis_conect();
 }
开发者ID:Levhav,项目名称:SimpleRedisClient,代码行数:7,代码来源:SimpleRedisClient.cpp

示例9: QObject

ChatServer::ChatServer(qint16 port, QObject *parent) :
    QObject(parent)
{
    ConnectionList = new QList<ChatConnection*>();
    setPort(port);
    bActive = false;
}
开发者ID:Wene,项目名称:test-server,代码行数:7,代码来源:chatserver.cpp

示例10: guard

void TreadmillFB303::make_fb303(
    std::shared_ptr<std::thread>& server_thread,
    int server_port,
    Scheduler& scheduler) {
  {
    folly::SharedMutex::WriteHolder guard(instance_mutex);
    if (instance) {
      LOG(FATAL) << "Global Treadmill FB303 instance was already set";
    }
    instance = std::make_shared<TreadmillFB303>(scheduler);
  }

  auto server = std::make_shared<apache::thrift::ThriftServer>();
  LOG(INFO) << "FB303 running on port " << server_port;
  server->setPort(server_port);
  server->setInterface(getGlobalTreadmillFB303());
  TLSConfig::applyDefaultsToThriftServer(*server);
  server_thread.reset(
      new std::thread([server]() { server->serve(); }),
      [server](std::thread* t) {
        server->stop();
        t->join();
        delete t;
      });
}
开发者ID:facebook,项目名称:treadmill,代码行数:25,代码来源:TreadmillFB303.cpp

示例11: ASensorEventQueue_disableSensor

void CSensorAndroidBuiltIn::closePort()
{
    if (m_pSensor && m_pSensorEventQueue) {
        ASensorEventQueue_disableSensor(m_pSensorEventQueue, m_pSensor);
    }
    if (m_pSensorManager && m_pSensorEventQueue) {
        ASensorManager_destroyEventQueue(m_pSensorManager, m_pSensorEventQueue);
    }

    strcpy(m_strVendor, "");
    strcpy(m_strSensor, "");

    m_pSensorManager = NULL;
    m_pSensor = NULL;
    m_pSensorEventQueue = NULL;
    m_pLooper = NULL;

    m_fResolution = 0.0f;
    m_minDelayMsec = 0;

    memset(m_xyz, 0x00, sizeof(float) * 3);
    memset(m_strSensor, 0x00, _MAX_PATH);
    memset(m_strVendor, 0x00, _MAX_PATH);

    setType();
    setPort();

}
开发者ID:happyj,项目名称:qcn,代码行数:28,代码来源:csensor_android_built_in.cpp

示例12: HTTPClientSession

HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket, Session::Ptr pSession):
	HTTPClientSession(socket),
	_pContext(socket.context()),
	_pSession(pSession)
{
	setPort(HTTPS_PORT);
}
开发者ID:12307,项目名称:poco,代码行数:7,代码来源:HTTPSClientSession.cpp

示例13: getWrapper

bool EClientSocket::eConnect( const char *host, unsigned int port, int clientId, bool extraAuth)
{
	if( m_fd == -2) {
		getWrapper()->error( NO_VALID_ID, FAIL_CREATE_SOCK.code(), FAIL_CREATE_SOCK.msg());
		return false;
	}

	// reset errno
	errno = 0;

	// already connected?
	if( m_fd >= 0) {
		errno = EISCONN;
		getWrapper()->error( NO_VALID_ID, ALREADY_CONNECTED.code(), ALREADY_CONNECTED.msg());
		return false;
	}

	// normalize host
	m_hostNorm = (host && *host) ? host : "127.0.0.1";

	// initialize host and port
	setHost( m_hostNorm);
	setPort( port);

	// try to connect to specified host and port
	ConnState resState = CS_DISCONNECTED;
	
    return eConnectImpl( clientId, extraAuth, &resState);
}
开发者ID:arvicco,项目名称:ib-ruby,代码行数:29,代码来源:EClientSocket.cpp

示例14: htonl

void Ipv4SocketAddress::setAddress(std::string const& addr) {
  if (addr.empty()) {
    pImpl_->ipv4address.sin_addr.s_addr = htonl(INADDR_ANY);
  } else {
    struct addrinfo addrhints;
    struct addrinfo *res;
    int err;
    memset(&addrhints, 0, sizeof(addrhints));

    if ((err = getaddrinfo(addr.c_str(), NULL, &addrhints, &res)) != 0) {
      std::cerr << "SocketAddress::setAddress(): Error in socket address translation for " << addr << ": " <<  gai_strerror(err) << std::endl;
    } else {
      if (res->ai_canonname)
        std::cerr << "Canonical name of socket: " << res->ai_canonname << std::endl;

      switch (res->ai_family) {
        case AF_INET:
          memcpy(&pImpl_->ipv4address, res->ai_addr, sizeof(pImpl_->ipv4address));
          setPort(port()); // Fix port in sockaddr
        break;
        default:
          std::cerr << "SocketAddress::setAddress(): Socket addresses other than ipv4 not supported!" << std::endl;
        break;
      }
      freeaddrinfo(res);
    }
  }
}
开发者ID:mrG7,项目名称:voip_workspace,代码行数:28,代码来源:socket_posix.cpp

示例15: LogRelFlow

STDMETHODIMP HostUSBDeviceFilterWrap::COMSETTER(Port)(IN_BSTR aPort)
{
    LogRelFlow(("{%p} %s: enter aPort=%ls\n", this, "HostUSBDeviceFilter::setPort", aPort));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = setPort(BSTRInConverter(aPort).str());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, "HostUSBDeviceFilter::setPort", hrc));
    return hrc;
}
开发者ID:bayasist,项目名称:vbox,代码行数:28,代码来源:HostUSBDeviceFilterWrap.cpp


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