Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to adjust the timeout on Delphi's TClientSocket

1,889 views
Skip to first unread message

Larry Ludden

unread,
Jan 11, 2000, 3:00:00 AM1/11/00
to
Is there any easy way to set the initial timeout when a TClientSocket goes
to connect?

Larry

Paul Gertzen

unread,
Jan 11, 2000, 3:00:00 AM1/11/00
to
I am not sure that there is a way to specify how long a TClientSocket.Open
method should take. I image it takes as long as it takes to resolve the name
(DNS lookup) and to find and connect to the server.

You can however set the send/receive timeout values by using a ctBlocking
TClientSocket by using a TWinSocketStream. The timeout is specified when
creating the TWinSocketStream. This can also be implemented on the server
side (TServerSocket) and works really well. If you need an example I will
gladly send one to you.

Paul

"Larry Ludden" <no...@net-gate.com> wrote in message
news:85gv1o$55...@bornews.borland.com...

FreaK

unread,
Jan 12, 2000, 3:00:00 AM1/12/00
to
i tried it this way .... i made a timer and in the OnTimer event ... made the socket inactive like
::

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if not ClientSocket1.Connected then
ClientSocket1.Active := false;
end;

its a rigged way to do it obviously ... and im sure there is a different more secure way to do it
but since nobody else replied to you i thought i would .... later man

freak

Larry Ludden

unread,
Jan 12, 2000, 3:00:00 AM1/12/00
to
Actually I'm using an IP address when I call connect, so there shouldn't be
any DNS ( I hope ). I use it blocking after that, using a stream, but I have
a program that checks numerous machines for a response on a certain port,
and if it can't connect to a machine it takes 10-20 seconds before it gets
the can't connect message. I ping it first to make sure it's talking, but
afterwards I try to go to a certain port. So I really need it on the
connect, and would rather not switch to a different component if I didn't
have to. But thanks very much for the reply.

Larry

Paul Gertzen <pger...@LiveTechnology.com> wrote in message
news:85h7np$563...@bornews.borland.com...


> I am not sure that there is a way to specify how long a TClientSocket.Open
> method should take. I image it takes as long as it takes to resolve the
name
> (DNS lookup) and to find and connect to the server.
>
> You can however set the send/receive timeout values by using a ctBlocking
> TClientSocket by using a TWinSocketStream. The timeout is specified when
> creating the TWinSocketStream. This can also be implemented on the server
> side (TServerSocket) and works really well. If you need an example I will
> gladly send one to you.
>
> Paul
>
> "Larry Ludden" <no...@net-gate.com> wrote in message
> news:85gv1o$55...@bornews.borland.com...

Paul Gertzen

unread,
Jan 12, 2000, 3:00:00 AM1/12/00
to
I also use this component to connect via a network. If you are using an IP
address and not a name, make sure you place it in the "Address" property and
not the "host" property. This DOES make a difference and solved my problem
for me. I believe it is a winsock issue and not a component issue anyway.
Let me know if this sorted it out.

Paul

"Larry Ludden" <no...@net-gate.com> wrote in message

news:85je0u$6h...@bornews.borland.com...

0 new messages