delphi - Indy10 TCP and asynchronous data exchange -
good morning all.i building delphi tcp server/client application using indy 10.0.52,with tidtcpclient , tidtcpserver. have problem receiving asynchronous responses server. here's part of sample code:
client:
procedure tfrmmain.clientsend(); begin tcpclient.iohandler.writeln('100|helloserver'); if tcpclient.iohandler.readln() = '1100' //here 1100 begin tcpclient.iohandler.writeln('200|are_you_ready_for_data?'); if tcpclient.iohandler.readln() = '1200' begin end; end; end;
server:
procedure tfrmmain.tcpserverexecute(acontext: tidcontext); var command:integer; var received,value:string; begin received := acontext.connection.iohandler.readln; command := strtoint(somesplitfunction(received,'first_part')); //here 100 value := somesplitfunction(received,'second_part'); //here 'helloserver' case command of 100:begin //do value... acontext.connection.iohandler.writeln('1100'); end; 200:begin //do value... acontext.connection.iohandler.writeln('1200'); end; end; end;
the problem case 200 on tcpserverexecute never executed, therefore second readln on client site never read.is multiple asynchronous data sending in single procedure supported?i have came across several examples simple indy tcp server/client applications, i'm little stuck here.just mention connection working , connect server without problems.
Comments
Post a Comment