Hi!
Ich hab auch Probleme mit den beiden Sockets... wenn ich übers Internet mit dem Serverprogramm connecten will, kommt der Fehler 10060 (Timeout). Mein Code:
Server:
Delphi-Quellcode:
uses WinInet;
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var i: integer;
msg:
string;
begin
Memo1.lines.add (Socket.ReceiveText);
for i:=0
to ServerSocket1.Socket.ActiveConnections -1
do
begin
with ServerSocket1.Socket.Connections [i]
do
if (Connected)
then SendText(Socket.RemoteHost+'
: ' + msg);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
InternetAutodial(internet_autodial_force_unattended,
handle);
end;
Client:
Delphi-Quellcode:
uses WinInet;
procedure TForm1.Button1Click(Sender: TObject);
//Zu IP connecten
begin
clientsocket1.Host:=edit2.text;
clientsocket1.Active:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
//Senden
begin
if ClientSocket1.active=true
then begin
ClientSocket1.Socket.SendText(edit1.text);
edit1.text:='
';
end;
end;
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
begin
Memo1.Lines.clear;
Memo1.Lines.Add(Socket.ReceiveText);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
InternetAutodial(internet_autodial_force_unattended,
handle);
end;
INDY versteh ich leider nicht...
MfG