Re: Question about howto do proper timeout checking on connections
From: Arkady Frenkel (arkadyf_at_hotmailxdotx.com)
Date: 07/04/04
- Next message: Arkady Frenkel: "Re: How can I attach Bluetooth modem to serial port programatically?"
- Previous message: Arkady Frenkel: "Re: Wireless LAN SDK"
- In reply to: Onemangang: "Re: Question about howto do proper timeout checking on connections"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 4 Jul 2004 09:18:43 +0300
Interesting that due to
http://support.microsoft.com/default.aspx?scid=kb;en-us;131623 sync socket
doesn't support timeouts and even return error on setsockopt.
Just to ckeck if it happen if you remoove overlap flag and call
setsockopt ?
Arkady
"Onemangang" <theonemangang@hotmail.com> wrote in message
news:OFvRq%23uXEHA.3944@tk2msftngp13.phx.gbl...
> Hi Alun.
>
> Thank you for your answer, that is a very good
> suggestion. I will make the list a linked list. This way
> "cpu expensive" deletion and insertion isnt needed.
> Only thing needed to push a socket to the end of the
> list is to exchange a few pointers, wich is fast to do.
>
> But, when doing this while running multiple threads,
> a lock will be needed to protect the list from corruption.
> Then each time you read or write and need to push the
> socket to the end of the list, this lock must be used.
>
> This sounds "expensive" in terms of locking that needs
> to be done when there is heavy traffic.
> Would this not cut down the performance ?
>
> - Onemangang
>
>
> "Alun Jones [MSFT]" <alunj@online.microsoft.com> skrev i en meddelelse
> news:eMQhdmrXEHA.2940@TK2MSFTNGP09.phx.gbl...
> > "Onemangang" <theonemangang@hotmail.com> wrote in message
> > news:uL2ZR2cXEHA.1656@TK2MSFTNGP09.phx.gbl...
> > > Setsockopt returns zero, indicating that the so_rcvtimeo was
> > > set sucessfully. I used a timeout of 2500 ms to test this.
> >
> > Implementing your own timeouts is a better way of doing this, because
you
> > can include the timeout processing in your regular worker thread pools.
I
> > don't know if so_rcvtimeo is supported for all non-blocking sockets, but
> the
> > documentation for setsockopt does state that so_rcvtimeo is supported
for
> > recv(). You are using WSARecv().
> >
> > On the topic of the way you're timing out, why not simply build a sorted
> > structure (a list or something), on the basis of how soon the socket
will
> > time-out? Each time data is received or sent on a socket, just pump it
to
> > the end of the list, and when it's time to check for timeouts, you just
> > remove those sockets at the front that are timed out, and don't search
if
> > the front socket isn't ready to be timed out. And you use the timeout
> value
> > of the first socket as being the next time to wait.
> >
> > Alun.
> > ~~~~
> >
> >
>
>
- Next message: Arkady Frenkel: "Re: How can I attach Bluetooth modem to serial port programatically?"
- Previous message: Arkady Frenkel: "Re: Wireless LAN SDK"
- In reply to: Onemangang: "Re: Question about howto do proper timeout checking on connections"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|