Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #613
| From | ittium <ittium@gmail.com> |
|---|---|
| Newsgroups | comp.unix.programmer, comp.programming.threads |
| Subject | Non-blocking socket operations |
| Date | 2011-09-26 10:39 +0530 |
| Organization | A noiseless patient Spider |
| Message-ID | <j5p1dq$8i9$1@dont-email.me> (permalink) |
Cross-posted to 2 groups.
Group, One of my software was running in to performance problems randomly. Debugging of the problem revealed, that blocking socket calls ( blocking the worker thread) were reason for these performance problems. I have recently modified the code so that it now uses the non-blocking operations. Given below are the changes that I have made. connect ------- connect on non-blocking socket may either return immediately or with EINPROGRESS. In the second case we start a timer and on timer expiry, using select, we find out whether connect was successful. fd is marked as connected if - socket fd is writable - writting zero bytes on socket is successful. If not Issue - Is this logic portable. Currently I can test the system on linux only but I would like to keep the system portable. Accept ------ - Accept is attempted on a listening non-blocking socket socket, till you get EAGAIN. Following errors are ignored (ie call accept again) -ECONNABORTED -EPROTO Issue - Is this logic portable. Currently I can test the system on linux only but I would like to keep the system portable. getaddrinfo ----------- getaddrinfo is executed in a thread result is returned in a call back and then this thread exit. Issue- When software is doing lot of DNS lookups, lots of such threads will be needed. Is there a better way of doing it. thanks Ittium
Back to comp.programming.threads | Previous | Next — Next in thread | Find similar | Unroll thread
Non-blocking socket operations ittium <ittium@gmail.com> - 2011-09-26 10:39 +0530 Re: Non-blocking socket operations Nobody <nobody@nowhere.com> - 2011-09-26 13:02 +0100 Re: Non-blocking socket operations Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-09-26 19:10 +0100 Re: Non-blocking socket operations William Ahern <william@wilbur.25thandClement.com> - 2011-09-26 13:44 -0700
csiph-web