Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #999
| From | squirrel.prog@gmail.com |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: IOCP and closing sockets |
| Date | 2012-08-16 18:12 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <14de0e44-6855-4ee0-8d87-5b7874d1336a@googlegroups.com> (permalink) |
| References | <0cba9161-6430-4cb9-91f9-47dd03a33cf7@t8g2000prm.googlegroups.com> |
On Thursday, July 14, 2011 11:20:15 AM UTC+8, David Barrett-Lennard wrote: > What's an appropriate way to abort socket connections using IOCP under > Windows? I would prefer not to synchronise access to the socket > handle. I would have hoped shutdown(SD_BOTH) would abort pending I/O > but it doesn't. It seems I need to use closesocket(), but that's > going to lead to all sorts of racing conditions. E.g. the socket > handle could be reused just before the next WSARecv(). Honestly i don't think closesocket will cause race conditions as long as you make sure in your codes no more I/O operations will be issued on the SOCKET after calling closesocket. All pending I/O operations will be aborted with failure. Do all sorts of cleanup jobs and forget about this SOCKET whatsoever. It'll be fine
Back to comp.programming.threads | Previous | Next | Find similar
Re: IOCP and closing sockets squirrel.prog@gmail.com - 2012-08-16 18:12 -0700
csiph-web