本文整理汇总了C++中setPort函数的典型用法代码示例。如果您正苦于以下问题:C++ setPort函数的具体用法?C++ setPort怎么用?C++ setPort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: QObject
/*!
* Standard constructor using \a parent as parent
*/
LogReceiver::LogReceiver(QObject *parent) :
QObject(parent),
m_socket(new QUdpSocket(this))
{
setPort(45454);
connect(m_socket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
}
开发者ID:hallenberg,项目名称:qmllive,代码行数:10,代码来源:logreceiver.cpp
示例17: while
void Server::start()
{
int findingPort = 50;
while (findingPort) {
try {
startServer();
setRunning(true);
findingPort = 0;
qDebug() << "Connected to port" << m_port;
if (m_mainWindow) {
m_mainWindow->notify("Server Started", "Port set to " + QString::number(m_port));
}
}
catch (const nzmqt::ZMQException& ex) {
if (ex.num() == 48) {
findingPort--;
setPort(m_port + 1);
} else {
qWarning() << Q_FUNC_INFO << "Exception:" << ex.num() << ex.what();
findingPort = 0;
emit failure(ex.what());
emit finished();
}
}
}
}
开发者ID:fagg,项目名称:nutmeg,代码行数:26,代码来源:server.cpp
示例18: getPort
u_result SocketAddress::setAddressFromString(const char * address_string, SocketAddress::address_type_t type)
{
int ans = 0;
int prevPort = getPort();
switch (type) {
case ADDRESS_TYPE_INET:
reinterpret_cast<sockaddr_storage *>(_platform_data)->ss_family = AF_INET;
ans = _inet_pton(AF_INET,
address_string,
&reinterpret_cast<sockaddr_in *>(_platform_data)->sin_addr);
break;
case ADDRESS_TYPE_INET6:
reinterpret_cast<sockaddr_storage *>(_platform_data)->ss_family = AF_INET6;
ans = _inet_pton(AF_INET6,
address_string,
&reinterpret_cast<sockaddr_in6 *>(_platform_data)->sin6_addr);
break;
default:
return RESULT_INVALID_DATA;
}
setPort(prevPort);
return ans<=0?RESULT_INVALID_DATA:RESULT_OK;
}
开发者ID:HANDS-FREE,项目名称:ROS_DEMO,代码行数:29,代码来源:net_socket.cpp
示例19: strcpy
UnixClient::UnixClient() {
char * localhost = new char[10];
strcpy(localhost, "127.0.0.1");
setIP(localhost);
setPort(12345);
setLogStream(&std::cout);
}
开发者ID:Freschmushroom,项目名称:Utils,代码行数:7,代码来源:UnixClient.cpp
示例20: setPort
FileServer::FileServer()
{
setPort(uHTTP::HTTP::DEFAULT_PORT);
setRootDirectory(".");
setVerbose(false);
addRequestListener(this);
}
开发者ID:swc4848a,项目名称:uHTTP4CC,代码行数:7,代码来源:FileServer.cpp
注:本文中的setPort函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论