本文整理汇总了C++中createServer函数的典型用法代码示例。如果您正苦于以下问题:C++ createServer函数的具体用法?C++ createServer怎么用?C++ createServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createServer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
(void) argc;
(void) argv;
int rc;
user_data_t user_data = {
.io_listen = -1,
.io = -1,
.control_io_listen = -1,
.control_io = -1,
.fio = NULL,
};
// user_context will be pointer to socket
scpi_context.user_context = &user_data;
SCPI_Init(&scpi_context);
user_data.io_listen = createServer(5025);
user_data.control_io_listen = createServer(CONTROL_PORT);
while(1) {
rc = waitServer(&user_data);
if (rc < 0) { // failed
perror("select failed");
exit(-1);
}
if (rc == 0) { // timeout
SCPI_Input(&scpi_context, NULL, 0);
}
if ((user_data.io_listen >= 0) && FD_ISSET(user_data.io_listen, &user_data.fds)) {
processIoListen(&user_data);
}
if ((user_data.control_io_listen >= 0) && FD_ISSET(user_data.control_io_listen, &user_data.fds)) {
processSrqIoListen(&user_data);
}
if ((user_data.io >= 0) && FD_ISSET(user_data.io, &user_data.fds)) {
processIo(&user_data);
}
if ((user_data.control_io >= 0) && FD_ISSET(user_data.control_io, &user_data.fds)) {
processSrqIo(&user_data);
}
}
return (EXIT_SUCCESS);
}
开发者ID:WCP52,项目名称:firmware,代码行数:53,代码来源:main.c
示例2: DCHECK
IClusterSPtr ServersManager::createCluster(IClusterSettingsBaseSPtr settings)
{
DCHECK(settings);
IClusterSPtr cl;
connectionTypes conT = settings->connectionType();
if(conT == REDIS){
IConnectionSettingsBaseSPtr root = settings->root();
if(!root){
return IClusterSPtr();
}
cl.reset(new RedisCluster(settings->connectionName()));
IClusterSettingsBase::cluster_connection_type nodes = settings->nodes();
for(int i = 0; i < nodes.size(); ++i){
IConnectionSettingsBaseSPtr nd = nodes[i];
if(nd){
IServerSPtr serv = createServer(nd);
cl->addServer(serv);
}
}
IDriverSPtr drv = cl->root()->driver();
DCHECK(drv->settings() == root);
}
else{
NOTREACHED();
}
return cl;
}
开发者ID:TakedWind,项目名称:fastoredis,代码行数:29,代码来源:servers_manager.cpp
示例3: QObject
SimpleMenu::SimpleMenu(QWidget* parent, WelcomeScreen* screen)
: QObject(parent)
, m_screen(screen)
, m_protocol(0)
, m_state(READY)
, m_player1(0)
, m_player2(0)
{
if (m_screen) {
// create buttons
m_server_btn = m_screen->addButton(0, 0, QIcon(QLatin1String(iconServer)),
tr("Host Game"));
m_client_btn = m_screen->addButton(0, 1, QIcon(QLatin1String(iconClient)),
tr("Connect to Game"));
// create connections
connect(m_server_btn, SIGNAL(clicked()),
this, SLOT(createServer()));
connect(m_client_btn, SIGNAL(clicked()),
this, SLOT(createClient()));
// WiFi direct
wpa = new Wpa;
wpa->setEnabled(true);
QVariantMap args;
args["DeviceName"] = QHostInfo::localHostName();
const char dev_type[8] = {0x00, 0x09, 0x00, 0x50, 0xf2, 0x04, 0x00, 0x05};
args["PrimaryDeviceType"] = QByteArray(dev_type, 8);
wpa->setProperties(args);
}
}
开发者ID:TI-OpenLink,项目名称:battleship,代码行数:32,代码来源:simplemenu.cpp
示例4: ServerCreateNoAccept
abyss_bool
ServerCreateNoAccept(TServer * const serverP,
const char * const name,
const char * const filesPath,
const char * const logFileName) {
bool const noAcceptTrue = TRUE;
bool const userChanSwitchFalse = FALSE;
bool success;
const char * error;
createServer(&serverP->srvP, noAcceptTrue,
NULL, userChanSwitchFalse,
0, &error);
if (error) {
TraceMsg(error);
success = FALSE;
xmlrpc_strfree(error);
} else {
success = TRUE;
setNamePathLog(serverP, name, filesPath, logFileName);
}
return success;
}
开发者ID:BehnamEmamian,项目名称:openholdembot,代码行数:27,代码来源:server.c
示例5: setupPins
void IOToaster::setup()
{
// Set the pin configuration
setupPins();
// Open serial communication
Serial.begin(9600);
Serial.setTimeout(5000);
// Load the configuration
if (isConfigured())
{
// Normal mode
_setupMode = false;
loadConfiguration();
connectServer();
setActivityLedState(HIGH);
}
else {
// Setup mode
setActivityLedState(LOW);
_setupMode = true;
createServer();
}
}
开发者ID:brenovit,项目名称:Radioino,代码行数:26,代码来源:iotoaster.cpp
示例6: ServerCreateSocket
abyss_bool
ServerCreateSocket(TServer * const serverP,
const char * const name,
TOsSocket const socketFd,
const char * const filesPath,
const char * const logFileName) {
abyss_bool success;
TSocket * socketP;
createSocketFromOsSocket(socketFd, &socketP);
if (socketP) {
abyss_bool const noAcceptFalse = FALSE;
const char * error;
createServer(&serverP->srvP, noAcceptFalse, socketP, 0, &error);
if (error) {
TraceMsg(error);
success = FALSE;
xmlrpc_strfree(error);
} else {
success = TRUE;
setNamePathLog(serverP, name, filesPath, logFileName);
}
} else
success = FALSE;
return success;
}
开发者ID:BenedictHiddleston,项目名称:xmlrpc-c-1.06.30,代码行数:33,代码来源:server.c
示例7: ServerCreate
abyss_bool
ServerCreate(TServer * const serverP,
const char * const name,
uint16_t const portNumber,
const char * const filesPath,
const char * const logFileName) {
abyss_bool const noAcceptFalse = FALSE;
abyss_bool success;
const char * error;
createServer(&serverP->srvP, noAcceptFalse, NULL, portNumber, &error);
if (error) {
TraceMsg(error);
xmlrpc_strfree(error);
success = FALSE;
} else {
success = TRUE;
setNamePathLog(serverP, name, filesPath, logFileName);
}
return success;
}
开发者ID:BenedictHiddleston,项目名称:xmlrpc-c-1.06.30,代码行数:26,代码来源:server.c
示例8: main
int main(void)
{
char choose;
int media;
printf("[?]Launch server on port 1337 ? (y/n) ");
scanf("%c" , &choose );
printf("[?]Media player to control:\n");
printf("[1]VLCPLayer\n");
printf("[2]OMXPlayer\n");
printf("[!]Choice: ");
scanf("%d", &media );
//Set the Media Player to controll
setMediaPlayer( media );
if( choose == 'y' )
{
printf("[+]Create server...\n");
createServer();
}
else
{
return 0;
}
printf("\n");
return 0;
}
开发者ID:feng912084760,项目名称:MediaController,代码行数:32,代码来源:main.c
示例9: scpi_server_thread
static void scpi_server_thread(void *arg) {
int rc;
(void)arg;
user_data.evtQueue = xQueueCreate(10, sizeof(uint32_t));
// user_context will be pointer to socket
scpi_context.user_context = &user_data;
SCPI_Init(&scpi_context);
user_data.io_listen = createServer(DEVICE_PORT);
user_data.control_io_listen = createServer(CONTROL_PORT);
while(1) {
rc = waitServer(&user_data);
if (rc < 0) { // failed
iprintf("select failed");
break;
}
if (rc == 0) { // timeout
SCPI_Input(&scpi_context, NULL, 0);
}
if ((user_data.io_listen != NULL) && (rc == SCPI_MSG_IO_LISTEN)) {
processIoListen(&user_data);
}
if ((user_data.control_io_listen != NULL) && (rc == SCPI_MSG_CONTROL_IO_LISTEN)) {
processSrqIoListen(&user_data);
}
if ((user_data.io != NULL) && (rc == SCPI_MSG_IO)) {
processIo(&user_data);
}
if ((user_data.control_io != NULL) && (rc == SCPI_MSG_CONTROL_IO)) {
processSrqIo(&user_data);
}
}
vTaskDelete(NULL);
}
开发者ID:richardhmm,项目名称:scpi-parser,代码行数:47,代码来源:scpi_server.c
示例10: main
int main(int argc, char** argv) {
(void) argc;
(void) argv;
int rc;
int listenfd;
char smbuffer[10];
// user_context will be pointer to socket
scpi_context.user_context = NULL;
SCPI_Init(&scpi_context);
listenfd = createServer(5025);
while (1) {
int clifd;
struct sockaddr_in cliaddr;
socklen_t clilen;
clilen = sizeof (cliaddr);
clifd = accept(listenfd, (struct sockaddr *) &cliaddr, &clilen);
if (clifd < 0) continue;
printf("Connection established %s\r\n", inet_ntoa(cliaddr.sin_addr));
scpi_context.user_context = &clifd;
while (1) {
rc = waitServer(clifd);
if (rc < 0) { // failed
perror(" recv() failed");
break;
}
if (rc == 0) { // timeout
SCPI_Input(&scpi_context, NULL, 0);
}
if (rc > 0) { // something to read
rc = recv(clifd, smbuffer, sizeof (smbuffer), 0);
if (rc < 0) {
if (errno != EWOULDBLOCK) {
perror(" recv() failed");
break;
}
} else if (rc == 0) {
printf("Connection closed\r\n");
break;
} else {
SCPI_Input(&scpi_context, smbuffer, rc);
}
}
}
close(clifd);
}
return (EXIT_SUCCESS);
}
开发者ID:bitwigglers,项目名称:scpi-parser,代码行数:59,代码来源:main.c
示例11: WXUNUSED
/*! Handler for Quit button
*
*/
void GdbServerWindow::OnChangeSettings(wxCommandEvent& WXUNUSED(event)) {
if (confirmDropConnection()) {
closeServer();
serverState = abort;
doSettingsDialogue();
createServer();
}
}
开发者ID:Gibbon1,项目名称:usbdm-eclipse-makefiles-build,代码行数:11,代码来源:GdbServerWindow.cpp
示例12: getInstance
ServerPtr ServerFactoryRegistry::createServer(const std::string &type,
const std::string &address,
uint16_t port,
int numThreads) {
auto factory = getInstance()->getFactory(type);
ServerOptions options(address, port, numThreads);
return factory->createServer(options);
}
开发者ID:MarcReis,项目名称:hiphop-php,代码行数:8,代码来源:server.cpp
示例13: start
void start() {
log() << "waiting for connections on port " << cmdLine.port << endl;
//DbGridListener l(port);
//l.listen();
ShardedMessageHandler handler;
MessageServer * server = createServer( cmdLine.port , &handler );
server->run();
}
开发者ID:xrogaan,项目名称:mongo,代码行数:8,代码来源:server.cpp
示例14: main
int main(int argc, char* argv[]) {
int local_port;
char* local_interface;
char* remote_host;
int remote_port;
int isClient = 0;
if (argc < 3 || argc > 4) {
perror("Error: improper number of args entered\nProper format: ./cs352proxy <port> <local_interface> or ./cs352proxy <remote_host> <remote_port> <local_interface>\n");
return 0;
} else if (argc == 3) {
local_port = atoi(argv[1]);
if (local_port < 1024 || local_port > 65536) {
printf("port out of range\n");
return 1;
}
local_interface = argv[2];
isClient = 0;
} else {
remote_host = argv[1];
remote_port = atoi(argv[2]);
if (remote_port < 1024 || remote_port > 65536) {
printf("port out of range\n");
return 1;
}
local_interface = argv[3];
isClient = 1;
}
if ( (tap_fd = allocate_tunnel(local_interface, IFF_TAP | IFF_NO_PI)) < 0) {
perror("Opening tap interface failed! \n");
exit(1);
}
int socketfd = socket(AF_INET, SOCK_STREAM, 0);
if (socketfd < 0) {
perror("Socket failed");
exit(1);
}
if (!isClient) {
TCPSocketfd = createServer(socketfd, local_port);
} else {
TCPSocketfd = createClient(socketfd, remote_port, remote_host);
}
pthread_t TAPthread, TCPthread;
pthread_create(&TAPthread, NULL, TAPHandle, NULL);
pthread_create(&TCPthread, NULL, TCPHandle, NULL);
pthread_join(TAPthread, NULL);
pthread_join(TCPthread, NULL);
return 0;
}
开发者ID:sgrzenda,项目名称:cs352proxypart3,代码行数:56,代码来源:cs352proxy_old.c
示例15: start
void start( const MessageServer::Options& opts ) {
balancer.go();
cursorCache.startTimeoutThread();
PeriodicTask::theRunner->go();
ShardedMessageHandler handler;
MessageServer * server = createServer( opts , &handler );
server->setAsTimeTracker();
server->run();
}
开发者ID:akkabin,项目名称:mongo,代码行数:10,代码来源:server.cpp
示例16: doSettingsDialogue
USBDM_ErrorCode GdbServerWindow::execute(bool skipOpeningDialogue) {
if (!skipOpeningDialogue) {
doSettingsDialogue();
}
Show();
createServer();
return BDM_RC_OK;
}
开发者ID:Gibbon1,项目名称:usbdm-eclipse-makefiles-build,代码行数:10,代码来源:GdbServerWindow.cpp
示例17: main
int main(void){
const unsigned int serverPort = 0xC001;
DiagnosticsServerPtr server = createServer(serverPort);
if(NULL == server) {
error("Failed to create the server");
}
/* Enter the eternal reactive event loop. */
for(;;){
HandleEvents();
} }
开发者ID:anjsxz,项目名称:c,代码行数:10,代码来源:main.c
示例18: SLOT
void MainWindow::setupActions()
{
KStandardGameAction::gameNew(m_main, SLOT(newGame()), actionCollection());
KStandardGameAction::restart(m_main, SLOT(restart()), actionCollection());
KStandardGameAction::highscores(m_main, SLOT(highscores()), actionCollection());
KStandardGameAction::quit(this, SLOT(close()), actionCollection());
QAction* action;
action = new QAction(i18n("&Single Player"), this);
action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconLocal)));
actionCollection()->addAction("game_local", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(localGame()));
action = new QAction(i18n("&Host Game..."), this);
action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconServer)));
actionCollection()->addAction("game_create_server", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(createServer()));
action = new QAction(i18n("&Connect to Game..."), this);
action->setIcon(QIcon::fromTheme( QLatin1String( SimpleMenu::iconClient))),
actionCollection()->addAction("game_create_client", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(createClient()));
// settings
action = new QAction(i18n("Change &Nickname..."), this);
actionCollection()->addAction("options_nickname", action);
connect(action, SIGNAL(triggered()), m_main, SLOT(changeNick()));
action = new KToggleAction(i18n("&Play Sounds"), this);
actionCollection()->addAction("options_sounds", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleSounds(bool)));
// This action will be disabled when a game is being run
action = new KToggleAction(i18n("&Adjacent Ships"), this);
action->setChecked(Settings::adjacentShips());
actionCollection()->addAction("options_adjacent", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleAdjacent(bool)));
// This action will be disabled when a game is being run
action = new KToggleAction(i18n("&Multiple Ships"), this);
action->setChecked(Settings::severalShips());
actionCollection()->addAction("options_multiple_ships", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleMultiple(bool)));
// config end of game message
action = new KToggleAction(i18n("Show End-of-Game Message"), this);
action->setChecked(true);
actionCollection()->addAction("options_show_endgame_message", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleEndOfGameMessage(bool)));
// actions for grid
action = new KToggleAction(i18n("Show &Left Grid"), this);
action->setChecked(true);
actionCollection()->addAction("options_showleftgrid", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleLeftGrid(bool)));
action = new KToggleAction(i18n("Show &Right Grid"), this);
action->setChecked(true);
actionCollection()->addAction("options_showrightgrid", action);
connect(action, SIGNAL(triggered(bool)), m_main, SLOT(toggleRightGrid(bool)));
setupGUI();
}
开发者ID:alasin,项目名称:knavalbattle,代码行数:55,代码来源:mainwindow.cpp
示例19: ServerCreateSocket2
void
ServerCreateSocket2(TServer * const serverP,
TSocket * const socketP,
const char ** const errorP) {
abyss_bool const noAcceptFalse = FALSE;
assert(socketP);
createServer(&serverP->srvP, noAcceptFalse, socketP, 0, errorP);
}
开发者ID:BenedictHiddleston,项目名称:xmlrpc-c-1.06.30,代码行数:11,代码来源:server.c
示例20: start
void start( const MessageServer::Options& opts ) {
setThreadName( "mongosMain" );
installChunkShardVersioning();
balancer.go();
cursorCache.startTimeoutThread();
PeriodicTask::theRunner->go();
ShardedMessageHandler handler;
MessageServer * server = createServer( opts , &handler );
server->setAsTimeTracker();
server->run();
}
开发者ID:dgriffith,项目名称:mongo,代码行数:12,代码来源:server.cpp
注:本文中的createServer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论