Hello,

Why don't you use events ? ICS is so good event oriented.

regards.

ccg> Hello,
ccg>    Is there any easier way to check if a port is open on a remote server
ccg> at runtime ?

ccg> var
ccg>    SocketError: Integer;

ccg> procedure TForm1.SessionConnected(Sender: TObject; ErrCode: Word);
ccg> begin
ccg>    SocketError := ErrCode;
ccg> end;

ccg> procedure TForm1.Button1Click(Sender: TObject);
ccg> var
ccg>    WSocket: TWSocket;
ccg>    Loop: Integer;
ccg> begin
ccg>    WSocket := twsocket.create(nil);
ccg>    WSocket.OnSessionConnected := SessionConnected;
ccg>    WSocket.Connect;

ccg>    Loop := 0;

ccg>    while Loop < 1000 do
ccg>    begin
ccg>      Application.ProcessMessages;
ccg>      Sleep(10);
ccg>      Inc(Loop, 10);
ccg>    end;

ccg>    Caption := IntToStr(SocketError); // WSocket.LastError = 0 ???
ccg>    FreeAndNil(WSocket);
ccg> end;

ccg> Thank you !!!


                      mailto:do...@yahoo.com

-- 
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