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

CAsyncSocket::Connect timeout

762 views
Skip to first unread message

Glenn Brude

unread,
Jan 22, 1999, 3:00:00 AM1/22/99
to
The timeout for the CAsyncSocket::Connect is far too
long for me, it takes about 30 seconds before the
function returns with an error, if the server is not
answering. Is there a way to decrease this timeout
to a few seconds?
/Glenn

Steve Poulsen

unread,
Jan 22, 1999, 3:00:00 AM1/22/99
to
Maybe you can, but I just do my own timeout. Connect returns immediately.
I then use a CTime to grab the current time. Then check it, sleep, check
it, sleep, .... If it times out, I then kill the socket. I run each
connection in a separate thread which also makes me be able to loop after
connect (with Sleeps) while checking. I have to loop anyway for waiting for
the connection, so it adds little to do the timeout stuff.

Steve

Glenn Brude wrote in message <36A8264B...@aptus.se>...

Glenn Brude

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to Steve Poulsen
Thank you for the suggestion, but in my app the
Connect does not return immediately if no connection
is made. Maybe that's because I'm really using
CSocket, and it does some other settings, changing
the way CAsyncSocket::Connect behaves.

/Glenn

Detlef Schmicker

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
Glenn Brude wrote:
As far as I understood the documentation

const int timeout=20000;
someCSocketObject.SetSockOpt(SO_RCVTIMEO,&timeout,sizeof(int));

should work, but I did not test it up to now.

Detlef

--
Detlef Schmicker, Sternbuschweg 41b, 47057 Duisburg
Produktentwicklung, Atomic Force Microskops
det...@physik.de


0 new messages