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

Function connect_server

lib_acl_cpp/samples/aio/aio_client/main.cpp:208–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206};
207
208static bool connect_server(IO_CTX* ctx, int id)
209{
210 // ��ʼ�첽����Զ�̷�����
211 acl::aio_socket_stream* stream = acl::aio_socket_stream::open
212 (ctx->handle, ctx->addr, ctx->connect_timeout);
213 if (stream == NULL) {
214 std::cout << "connect " << ctx->addr << " error!" << std::endl;
215 std::cout << "stoping ..." << std::endl;
216 if (id == 0)
217 ctx->handle->stop();
218 return false;
219 }
220
221 // �������Ӻ�Ļص�������
222 client_io_callback* callback = new client_io_callback(ctx, stream, id);
223
224 // �������ӳɹ��Ļص�������
225 stream->add_open_callback(callback);
226
227 // ��������ʧ�ܺ�ص�������
228 stream->add_close_callback(callback);
229
230 // �������ӳ�ʱ�Ļص�������
231 stream->add_timeout_callback(callback);
232 return true;
233}
234
235static void usage(const char* procname)
236{

Callers 2

open_callbackMethod · 0.70
mainFunction · 0.70

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…