Hi amos,

creating a socket and making a connection are two different things!

A socket will be created in any case. And it should be successfull
in most cases (This depends not on a working listener or something 
else). The socket creation is done at your points (1) and (2)

The connection is done after the socket creation at (3), because you 
need a socket before you can make a connection.
If that connection fail on any reason the FLastError is <> 0

But, the socket is valid anymore. So if you try a second Connect,
TBlockSocket has no need to create a socket again, because the socket
was already created. It's just not connected.
This means that a second call to Connect will not go
through your point (2).

I hope this will help you to understand the difference between
"Create a socket" and "Make a connection"

Alex

> procedure TBlockSocket.Connect(IP, Port: string);
> var
>   Sin: TVarSin;
> begin
>   SetSin(Sin, IP, Port);
>   if FLastError = 0 then
>   begin
>     if FSocket = INVALID_SOCKET then      (1)
>       InternalCreateSocket(Sin);                  (2)
>     SockCheck(synsock.Connect(FSocket, Sin));     (3)
>     if FLastError = 0 then
>       GetSins;
>     FBuffer := '';
>     FLastCR := False;
>     FLastLF := False;
>   end;
>   ExceptCheck;
>   DoStatus(HR_Connect, IP + ':' + Port);
> end;
> 
> (1) the condition result is true so (2) is executed
> (2) it seems to create a socket to "somewhere" so the LastError is 0 and 
> everything is supposedly OK but needless to say the 
> connection goes nowhere really
> please advice
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> 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
> synalist-public@lists.sourceforge.net
> 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
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to