unit Client1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
StdCtrls, WinSock, IdCustomTCPServer, IdTCPServer;
type
TALiz = class(TForm)
TCPClient : TIdTCPClient;
function GetLizfromServer(SW: String; Liz: String; PKey: String;
IP: String): string;
end;
var ALiz: TALiz;
implementation
{$R *.dfm}
uses ping;
function TALiz.GetLizfromServer(SW: String; Liz: String; PKey: String;
IP: String): string;
var Puffer : string;
var VErr : Boolean;
var QIP : in_addr;
begin
if GetIPByName('www.schneider-it-gmbh.dyndns.org',QIP) then
begin
TCPClient.Host := inet_ntoa(QIP);
Result := '';
VErr := False;
try
TCPClient.Connect;
Puffer := SW + '#' + PKey + '#' + Liz + '#' +
IP;
if TCPClient.Connected then
begin
TCPClient.GetResponse(100);
if TCPClient.LastCmdResult.Text.Strings[0] = 'Server ready' then
begin
TCPClient.SendCmd(Puffer, 200);
Puffer := TCPClient.LastCmdResult.Text.Strings[0];
if copy(Puffer,1,4) <> 'NOGO' then
Result := Puffer
else
begin
......
end;
end
else
Result := 'Verbindungsfehler 3';
end;
TCPClient.IOHandler.Close;
TCPClient.Disconnect;
except
Result := 'Verbindungsfehler 1';
end;
end
else
Result := 'DNS-Fehler!';
end;
end.