Hi amos,
i'm not sure what's your problem in detail, but:
--------------------
cSock := TTCPBlockSocket.Create;
try
cSock.Connect('www.google.de', '80');
if cSock.LastError = 0 then
begin
// Success
end else begin
// Connection failed.
end;
finally
cSock.Free;
end;
--------------------
should be enough.
The Connect method will create a socket in any case, of course!
But on any connection failure the LastError property is <> 0
In your case (No listening service) LastError should be 10061
('Connection refused').
Alex
amos schrieb:
> i will appreciate any kind of help regarding this problem:
>
> hi
>
> i do the following:
>
> cSock := TTCPBlockSocket.Create;
> try
> cSock.CreateSocket;
> cSock.SetLinger(True, 10000);
> cSock.Connect(<IP>,<PORT>); <-------------
> if cSock.LastError = 0 then
> begin
> end;
> finally
> cSock.CloseSocket;
> cSock.Free;
> end;
>
> it seems that the .Connect command creates a socket even to a non-relevant
> IP/PORT. moreover, i didnt create a listener on
> my computer and still, the connect returned with no error as if it succeeded
> to connect "somewhere".
>
> how can i distinguish a "real" connection and a connection which leads
> nowhere?
> thanks
>
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> synalist-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/synalist-public
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public