Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : idTCPClient & idTCPServer
| Subject: | idTCPClient & idTCPServer |
| Posted by: | "Ian Groves" (ian@remove_this_bitigroves.f9.co.uk) |
| Date: | Tue, 15 Aug 2006 13:40:50 |
Indy 10.0.0.52 - D7
I am trying to make a simple app where a client (idtcpclient) connects to a
server (idtcpserver) and exchanges info, my problem is stores connection
specific info for example...
This is my simple protocol at the moment....
procedure TMainForm.IdTCPServer1Execute(AContext: TIdContext);
var
Param: Integer;
Data: string;
aUserName, aPassword: string; <<<<<<<<<<<<<<<<<THIS IS MY PROBLEM AT THE
MOMENT
begin
Data := AContext.Connection.Socket.ReadLn;
Param := StrToInt(Copy(Data, 1, 2));
Delete(Data, 1, 2);
case Param of
10: Log('Client is version: ' + Data);
11: begin
aUsername := Data;
Log('Client Username is: ' + aUsername);
end;
12: begin
aPassword := Data;
Log('Client Password is: ' + aPassword);
end;
99: Log(aUsername + ' - Client sends message: ' + Data);
end;
end;
When 2 clients connect i cant determine which one I am dealing with as
aUsername and aPassword are clearerd each time some data is sent, I presume
i need to attach this info to AContext somehow, but how do I do this.
Thanks in advance.
Ian Groves