MCPcopy Create free account
hub / github.com/acl-dev/acl / connect_server

Method connect_server

lib_acl_cpp/samples/winaio/AioClient.cpp:151–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151bool CConnectClientCallback::connect_server(IO_CTX* ctx, int id)
152{
153 // ��ʼ�첽����Զ�̷�����
154 // const char* addr = "221.194.139.155:18887";
155 // ctx->connect_timeout = 1;
156 aio_socket_stream* stream = aio_socket_stream::open(ctx->handle,
157 ctx->addr, ctx->connect_timeout);
158 if (stream == NULL)
159 {
160 std::cout << "connect " << ctx->addr << " error!" << std::endl;
161 std::cout << "stoping ..." << std::endl;
162 if (id == 0)
163 ctx->handle->stop();
164 return (false);
165 }
166
167 // �������Ӻ�Ļص�������
168 CConnectClientCallback* callback = new CConnectClientCallback(ctx, stream, id);
169
170 // �������ӳɹ��Ļص�������
171 stream->add_open_callback(callback);
172
173 // ��������ʧ�ܺ�ص�������
174 stream->add_close_callback(callback);
175
176 // �������ӳ�ʱ�Ļص�������
177 stream->add_timeout_callback(callback);
178 return (true);
179}

Callers

nothing calls this directly

Calls 5

openFunction · 0.85
add_open_callbackMethod · 0.80
add_close_callbackMethod · 0.80
add_timeout_callbackMethod · 0.80
stopMethod · 0.45

Tested by

no test coverage detected