c++ - Indy TCP/IP Server with Client using Chilkat Library -
im trying use client chilkat library since client has written in visual c++ , not borland c++(c++builder). connecting work try send string client server doesn't hit idtcpserverexecute
function. possible use library client server using? if so, how?
edit: got working client sends string server. handle client message this:
unicodestring message = acontext->connection->socket->alldata();
instead of:
unicodestring message = acontext->connection->socket->readln();
now there simliar option send response string server?
if (idhttp->get ("http://*/index.php?option=com_bookpro&controller=customer&task=bpajaxlogin&username=" + sltokens->strings[1] + "&password=" + sltokens->strings[2] + "&product_id=" + class) == "true") { addlog("1"); char* response = "test"; acontext->connection->socket->write(response); addlog("2"); } else { acontext->connection->socket->writeln ("authentication failed"); }
it comes addlog("1");
, not display addlog("2");
.
client code(using winsocks tests atm.):
recv(connectsocket, recvbuf, recvbuflen, 0); printf("bytes received: %d, %s\n", sizeof(recvbuf), recvbuf);
im trying use client chilkat library since client has written in vcl c++ , not borland c++(c++builder).
what "vcl c++" compared "borland c++"? referring borland's command-line compiler, opposed c++builder compiler? or referring different third party vcl framework has nothing borland's vcl framework in c++builder? please clearify question.
connecting work try send string client server doesn't hit idtcpserverexecute function.
that hard explain without seeing actual server code.
tidtcpserver
creates new thread each connected client. tidtcpserver::onexecute
event not tied actual network activity, triggers in endless loop lifetime of each thread. way onexecute
event not triggered @ if either:
you deadlocking thread in
tidtcpserver::onconnect
event, such doing not thread-safe. or, doing cause exception thrown , not catching it. uncaught exception terminate thread.the client disconnects while
tidtcpserver::onconnect
event handler still running, or in between time after event handler exits , beforetidtcpserver::onexecute
event handler called first time.
is possible use library client server using?
of course possible. tcp standardized transport protocol. long different tcp implementations adhere standard, can communicate each other without problem. fundamental stable communications across multiple platforms, , internet relies on this.
Comments
Post a Comment