Hi Francois,
I am building a server client application for monitoring few pc's which are in different locations(not the same network). The ID what I am having is this one(tag:FClientNo), I get it when the client connects to the server.
<--------------- C O D E ------------------------------------>
procedure TfrmMain.SslWSocketServerClientConnect(Sender : TObject;
 Client : TWSocketClient;
 Error  : Word);
begin
   with Client as TTcpSrvClient do begin
       Inc(FClientNo); // Increment unique client no
       Tag := FClientNo; // tag connecting client with it's id
       Display('There is now ' +
       IntToStr(TWSocketServer(Sender).ClientCount) +
               ' clients connected.');
       Display('Client connected:|' +IntToStr(Tag)+ '|' +
               ' Remote:' +PeerAddr+ ':' +PeerPort+ '|' +
               ' Local:'  +GetXAddr+ ':' +GetXPort);

       LineMode            := True;
       LineEdit            := True;
       LineLimit           := 80; { Do not accept long lines }
       OnDataAvailable     := ClientDataAvailable;
       OnLineLimitExceeded := ClientLineLimitExceeded;
       OnBgException       := ClientBgException;
       ConnectTime         := Now;
       //You need to start inserting data into the xml here
   end;
end;
<--------------- C O D E ------------------------------------>

And this sends the info to the server (the client is sending), here is everything I need from the client and I can get lot more.
<--------------- C O D E ------------------------------------>
procedure TfrmMain.SslWSocketClientSessionConnected(Sender: TObject; ErrCode: word);
var
 Log: TextFile;
begin
 if Errcode <> 0 then
 begin
   memoDisplay.Lines.Add('Can''t connect, error #' + IntToStr(ErrCode));
 end
 else
 begin
   SslWSocketClient.SslEnable := True;
   SslWSocketClient.StartSslHandshake;
   tlbbtnConnect.Enabled := False;
   menuFileConnect.Enabled := False;
   menuFileDisconnect.Enabled := True;
   memoDisplay.Lines.Add('Connection established succesfully.');
 end;
 SslWSocketClient.SendStr('Computer Name:' + '|' + editComputerName.Text +
   '|' + 'IP Address:' + '|' + GetIPAddress + '|' + 'Language:' +
   '|' + GetWindowsLanguage + '|' + 'User name:' + '|' + UserInfo + '|' +
   'OS:' + '|' + SO + '|' + 'Date & time:' + '|' +
   FormatdateTime('dd.mm.yyyy hh:nn:ss', Now) + #13#10);
stbMain.Panels[1].Text := 'System event lines: ' + IntToStr(memoDisplay.Lines.Count);
 {Writing events into the log}
AssignFile(Log, ExtractFilePath(Forms.Application.ExeName) + 'System\Log\system_log.txt');
 Append(Log); {Continue adding events into the log}
 {Add log events}
 Writeln(Log,memoDisplay.Text);
 CloseFile(Log);
end;
<--------------- C O D E ------------------------------------>

-----Original Message----- From: Francois PIETTE
Sent: Wednesday, May 11, 2011 2:28 PM
To: ICS support mailing
Subject: Re: [twsocket] Computer's name

I hope I have explained okay.

I do not grasp your complete architecture.
Which programs are you writing ? A server, a client, both ?
What is the ID you are talking about ?
Which protocol are you using ? You own ?

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to