本文整理汇总了C++中connectServer函数的典型用法代码示例。如果您正苦于以下问题:C++ connectServer函数的具体用法?C++ connectServer怎么用?C++ connectServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connectServer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setServer
bool Camera_INDIClass::Connect(const wxString& camId)
{
// If not configured open the setup dialog
if (strcmp(INDICameraName,"INDI Camera")==0) CameraSetup();
// define server to connect to.
setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
// Receive messages only for our camera.
watchDevice(INDICameraName.mb_str(wxConvUTF8));
// Connect to server.
if (connectServer()) {
return !ready;
}
else {
// last chance to fix the setup
CameraSetup();
setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
watchDevice(INDICameraName.mb_str(wxConvUTF8));
if (connectServer()) {
return !ready;
}
else {
return true;
}
}
}
开发者ID:xeqtr1982,项目名称:phd2,代码行数:25,代码来源:cam_INDI.cpp
示例2: SetupDialog
bool ScopeINDI::Connect()
{
// If not configured open the setup dialog
if (INDIMountName == wxT("INDI Mount")) {
SetupDialog();
}
// define server to connect to.
setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
// Receive messages only for our mount.
watchDevice(INDIMountName.mb_str(wxConvUTF8));
// Connect to server.
if (connectServer()) {
return !ready;
}
else {
// last chance to fix the setup
SetupDialog();
setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
watchDevice(INDIMountName.mb_str(wxConvUTF8));
if (connectServer()) {
return !ready;
}
else {
return true;
}
}
}
开发者ID:AndresPozo,项目名称:phd2,代码行数:27,代码来源:scope_INDI.cpp
示例3: 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
示例4: throw
void SocketSender::sendLog(std::list<MLogRec> &logs) throw(SendException)
{
readFailFile(logs);
connectServer();
sendData(logs);
saveFailFile(logs);
}
开发者ID:dmsTest,项目名称:dms,代码行数:7,代码来源:LogSender.cpp
示例5: main
int main(void)
{
//Diccionario de funciones de comunicacion
fns = dictionary_create();
dictionary_put(fns, "server_saludar", &server_saludar);
//Creo estrucutra de datos para esta conexion
data_client * data = malloc(sizeof(data_client));
data->x = 2;
data->y = 9;
//Me conecto a servidor, si hay error informo y finalizo
if((socket_server = connectServer(ip, port, fns, &server_connectionClosed, data)) == -1)
{
printf("Error al intentar conectar a servidor. IP = %s, Puerto = %d.\n", ip, port);
exit(1);
}
printf("Se ha conectado exitosamente a servidor. Socket = %d, IP = %s, Puerto = %d.\n", socket_server, ip, port);
//saludo a servidor
runFunction(socket_server, "client_saludar", 3, "hola", "como", "estas");
//Dejo bloqueado main
pthread_mutex_init(&mx_main, NULL);
pthread_mutex_lock(&mx_main);
pthread_mutex_lock(&mx_main);
return EXIT_SUCCESS;
}
开发者ID:nahuelpanzarasa,项目名称:socket-library-c,代码行数:29,代码来源:client.c
示例6: setDomainSocketPath
int CSocketClient::start(int nSocketType, const char* cszAddr, short nPort,
int nStyle)
{
if (AF_UNIX == nSocketType)
{
setDomainSocketPath(cszAddr);
}
else if (AF_INET == nSocketType)
{
if (-1 == setInetSocket(cszAddr, nPort))
{
_DBG("set INET socket address & port fail");
return -1;
}
}
if (-1 != createSocket(nSocketType, nStyle))
{
if (SOCK_STREAM == nStyle)
{
if (-1 == connectServer())
{
socketClose();
return -1;
}
}
_DBG("[Socket Client] Socket connect success");
return getSocketfd();
}
return -1;
}
开发者ID:jugo8633,项目名称:ControllerSystem,代码行数:33,代码来源:CSocketClient.cpp
示例7: main
/*
* ftpc program sends the target file
* to the server specified by the user
* with ip address and port number.
*/
int main(int argc, char *argv[]) {
int sockfd = -1;
// precheck arguments
if(preCheckArgs(argc, argv) == -1) {
exit(-1);
}
// create the socket
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd < 0) {
fprintf(stderr, "ftpc: ERROR: Can't create the socket.\n");
exit(-1);
}
// connect to the server
if(connectServer(sockfd, /*ip address*/argv[1], /*port*/argv[2]) < 0) {
exit(-1);
}
// send the file to the server
sendFileToServer(sockfd, argv[3]);
return 0;
}
开发者ID:lx-2015,项目名称:NetworkProgrammingProjects,代码行数:30,代码来源:ftpc.c
示例8: readResponse
int ESP8266_XYZ::httpGet(const char* server, String path, int port, String *response){
String msg = "";
String server_str = server;
if(connectServer(server, port)){
#ifdef DEBUG
Serial.println("Connected to server");
#endif
} else {
#ifdef DEBUG
Serial.println("Connection Failure");
#endif
}
server_str += ":";
server_str += String(port);
//GET HTTP/1.1\r\nHost: \r\n\r\n
//Solicitud HTTP al servidor
//Header
msg += "GET ";
msg += path;
msg += " HTTP/1.1\r\nHost: ";
msg += server_str;
msg += "\r\n\r\n";
//Se envía el mensaje al servidor
client.print(msg);
//Se obtiene el código de estado de la solicitud
return readResponse(response);
}
开发者ID:ImagineXYZ,项目名称:ArduinoLibraries,代码行数:33,代码来源:ESP8266_XYZ_StandAlone.cpp
示例9: connectServer
void MainWindow::changeServerStatus(bool s)
{
if(s)
connectServer();
else
disconnectServer();
}
开发者ID:feda12,项目名称:prolog-suite-client,代码行数:7,代码来源:mainwindow.cpp
示例10: gethostid
int FClient::requestID(const char *desc)
{
int socketfd;
unsigned char buf[128];
int i;
unsigned int uret;
FILE *f;
int hid;
hid = gethostid();
/* connect to the server */
socketfd = connectServer();
if (socketfd<0) {
return 0;
}
/* send the request */
sendMessage(socketfd,"",FGETMACHINEID);
/* read the id */
uret = readU32(socketfd);
/* close the socket */
close(socketfd);
return uret;
}
开发者ID:roeland-frans,项目名称:q-rap,代码行数:28,代码来源:fclient.cpp
示例11: connectServer
int FClient::sendFile(const char *fname)
{
int socketfd;
unsigned char buf[128];
int i;
unsigned int hashval;
FILE *f;
/* connect to the server */
socketfd = connectServer();
if (socketfd<0) {
return 0;
}
/* send the request */
sendMessage(socketfd,fname,FSENDFILE);
/* send the file */
writeFile(fname,socketfd);
/* close the socket */
close(socketfd);
return 1;
}
开发者ID:roeland-frans,项目名称:q-rap,代码行数:27,代码来源:fclient.cpp
示例12: VLOG
void RSocketServer::onRSocketSetup(
std::shared_ptr<RSocketServiceHandler> serviceHandler,
std::shared_ptr<ConnectionSet> connectionSet,
bool scheduledResponder,
std::unique_ptr<DuplexConnection> connection,
SetupParameters setupParams) {
const auto eventBase = folly::EventBaseManager::get()->getExistingEventBase();
VLOG(2) << "Received new setup payload on " << eventBase->getName();
CHECK(eventBase);
auto result = serviceHandler->onNewSetup(setupParams);
if (result.hasError()) {
VLOG(3) << "Terminating SETUP attempt from client. "
<< result.error().what();
connection->send(
FrameSerializer::createFrameSerializer(setupParams.protocolVersion)
->serializeOut(Frame_ERROR::rejectedSetup(result.error().what())));
return;
}
auto connectionParams = std::move(result.value());
if (!connectionParams.responder) {
LOG(ERROR) << "Received invalid Responder. Dropping connection";
connection->send(
FrameSerializer::createFrameSerializer(setupParams.protocolVersion)
->serializeOut(Frame_ERROR::rejectedSetup(
"Received invalid Responder from server")));
return;
}
const auto rs = std::make_shared<RSocketStateMachine>(
scheduledResponder
? std::make_shared<ScheduledRSocketResponder>(
std::move(connectionParams.responder), *eventBase)
: std::move(connectionParams.responder),
nullptr,
RSocketMode::SERVER,
connectionParams.stats,
std::move(connectionParams.connectionEvents),
setupParams.resumable
? std::make_shared<WarmResumeManager>(connectionParams.stats)
: ResumeManager::makeEmpty(),
nullptr /* coldResumeHandler */);
if (!connectionSet->insert(rs, eventBase)) {
VLOG(1) << "Server is closed, so ignore the connection";
connection->send(
FrameSerializer::createFrameSerializer(setupParams.protocolVersion)
->serializeOut(Frame_ERROR::rejectedSetup(
"Server ignores the connection attempt")));
return;
}
rs->registerCloseCallback(connectionSet.get());
auto requester = std::make_shared<RSocketRequester>(rs, *eventBase);
auto serverState = std::shared_ptr<RSocketServerState>(
new RSocketServerState(*eventBase, rs, std::move(requester)));
serviceHandler->onNewRSocketState(std::move(serverState), setupParams.token);
rs->connectServer(
std::make_shared<FrameTransportImpl>(std::move(connection)),
std::move(setupParams));
}
开发者ID:ReactiveSocket,项目名称:reactivesocket-cpp,代码行数:59,代码来源:RSocketServer.cpp
示例13: initPeerSocket
// Initialize Networking Sockets
void initPeerSocket(void) {
#ifdef SERVERMODE
fdPeerSock = acceptClient();
#endif
#ifdef CLIENTMODE
fdPeerSock = connectServer();
#endif
}
开发者ID:chanyoungkim,项目名称:RobotModuleManipulate,代码行数:10,代码来源:mission_server.c
示例14: initRemoteDebugging
void initRemoteDebugging()
{
WORD ver = MAKEWORD(1, 1);
WSADATA data;
WSAStartup(ver, &data);
debugEventSocket = connectServer("127.0.0.1", 1523);
if (debugEventSocket < 0)
debugEventSocket = 0;
}
开发者ID:oleksiyp,项目名称:mysmall-OS,代码行数:10,代码来源:remote_debug.cpp
示例15: connectServer
bool SocketTest::init()
{
if (!Layer::init())
{
return false;
}
connectServer();
return true;
}
开发者ID:huangshucheng,项目名称:MyUtil,代码行数:10,代码来源:SocketTest.cpp
示例16: Disconnect
void INDIConfig::Connect()
{
dev->Clear();
Disconnect();
INDIhost = host->GetLineText(0);
port->GetLineText(0).ToLong(&INDIport);
setServer(INDIhost.mb_str(wxConvUTF8), INDIport);
if (connectServer()) {
connect_status->SetLabel(_T("Connected"));
}
}
开发者ID:elenbert,项目名称:open-phd-guiding,代码行数:11,代码来源:config_INDI.cpp
示例17: threadStart
void *
threadStart(void *arg)
{
int server_fd = connectServer(server_info.address, server_info.port);
if(server_fd == -1)
pthread_exit((void *)-1);
test(server_fd);
close(server_fd);
pthread_exit((void *)0);
}
开发者ID:fanfank,项目名称:Chatty,代码行数:11,代码来源:pressuretest.c
示例18: startDataSocket
int startDataSocket(int socket, char *msg)
{
int sockdata = 0;
int port = convertPortNo(msg);
char ip[strlen(msg)];
char *address;
int i = 0, count = 0, n = 0;
char recvBuff[1024];
char filename[100]="fileName\n";
/*
*
* * * * * CONVERT PASV MESSAGE TO IP ADDRESS
*
*/
strcpy(ip, msg);
while (ip[i] != '\0')
{
if (ip[i] == ',')
{
ip[i] = '.';
count++;
}
if (count == 4)
{
ip[i] = '\0';
}
i++;
}
i = 0;
count = 0;
address = ip + 1;
//printf("\n Creating Data Socket... \n");
//printf("\n portno:%i", port);
//printf("\n Connecting Data Socket To Server... \n");
n = connectServer(socket, address, port);
if (n < 0)
{
printf("%s\n", strerror(errno));
exit(1);
}
return n;
}
开发者ID:nickkpoon,项目名称:CS176B2,代码行数:52,代码来源:test.c
示例19: disconnectServer
int OSGScaleViewer::run()
{
// 1. connect to server
eq::ServerPtr server = new eq::Server();
if( !connectServer( server ))
{
EQERROR << "Can't open server" << std::endl;
return EXIT_FAILURE;
}
// 2. choose config
eq::ConfigParams configParams;
Config* config = static_cast<Config*>( server->chooseConfig( configParams));
if( !config )
{
EQERROR << "No matching config on server" << std::endl;
disconnectServer( server );
return EXIT_FAILURE;
}
config->setInitData( _initData );
if( !config->init( ))
{
server->releaseConfig( config );
disconnectServer( server );
return EXIT_FAILURE;
}
else if( config->getError( ))
EQWARN << "Error during initialization: " << config->getError()
<< std::endl;
// 4. run main loop
while( config->isRunning( ))
{
config->startFrame();
config->finishFrame();
}
config->finishAllFrames();
// 5. exit config
config->exit();
// 6. cleanup and exit
server->releaseConfig( config );
if( !disconnectServer( server ))
EQERROR << "Client::disconnectServer failed" << std::endl;
server = 0;
return EXIT_SUCCESS;
}
开发者ID:MichaelVlad,项目名称:Equalizer,代码行数:52,代码来源:osgScaleViewer.cpp
示例20: connectServer
bool TServerList::onRecv()
{
// Grab the data from the socket and put it into our receive buffer.
unsigned int size = 0;
char* data = sock.getData(&size);
if (size != 0)
rBuffer.write(data, size);
if (!main())
connectServer();
return true;
}
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:13,代码来源:TServerList.cpp
注:本文中的connectServer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论