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

Method open_callback

lib_acl_cpp/samples/winaio/AioClient.cpp:123–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123bool CConnectClientCallback::open_callback()
124{
125 // ���ӳɹ�������IO��д�ص�����
126 client_->add_read_callback(this);
127 client_->add_write_callback(this);
128 ctx_->nopen_total++;
129
130 acl_assert(id_ > 0);
131 if (ctx_->nopen_total < ctx_->nopen_limit)
132 {
133 // ��ʼ������һ�����ӹ���
134 if (connect_server(ctx_, id_ + 1) == false)
135 std::cout << "connect error!" << std::endl;
136 }
137
138 // �첽���������������
139 //client_->format("hello world: %d\n", nwrite_);
140 char buf[256];
141 snprintf(buf, sizeof(buf), "hello world: %d\n", nwrite_);
142 client_->write(buf, (int) strlen(buf));
143
144 // �첽�ӷ�������ȡһ������
145 client_->gets(ctx_->read_timeout, false);
146
147 // ��ʾ�����첽����
148 return (true);
149}
150
151bool CConnectClientCallback::connect_server(IO_CTX* ctx, int id)
152{

Callers

nothing calls this directly

Calls 5

add_read_callbackMethod · 0.80
add_write_callbackMethod · 0.80
getsMethod · 0.80
connect_serverFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected