Len Holgate

  • Content count

  • Joined

  • Last visited

Community Reputation

151 Neutral

About Len Holgate

  • Rank

Personal Information

  1. Your code's quite hard to read and understand and ignoring all the issues that others have raised, I think your actual problem is here...   result = accept_ex(info->listen_socket,       info->client_socket,       &info->buffer.buffer,       info->buffer.size - ((sizeof(sockaddr_in) + 16) * 2),       sizeof(sockaddr_in) + 16,       sizeof(sockaddr_in) + 16,       &nb,       &info->overlapped);   You're passing a non zero side for the buffer which means you're asking for the accept not to return until data is sent on the connection by the connecting peer.   I'd suggest you take a look at this article and the working code that it contains: http://www.codeproject.com/Articles/2374/A-reusable-high-performance-socket-server-class
  2. I have some free code that includes some TCP IOCP server examples which should be pretty easy to adjust to your needs if you want to get a feel for how IOCP works.   You can get the code from here: http://www.serverframework.com/products---the-free-framework.html
  3. IO completion port

    [quote name='Laval B' timestamp='1337355349' post='4941201'] Thank you very much. I'll take a look at it. Iocp can be a bit confusing when you look at it for the fist time. [/quote] Yes, it can, but it's actually fairly straight forward once you get your head around the concept. Remaining async throughout your data processing is the more complex part but that's not too bad if you just build state machines. The code that I linked to is stable and reliable but it is missing quite a few features that you probably should think about, especially if your server will be sending 'push' notifications to clients that may be on slow network links. I talk about the issues that you can come up against if you ignore TCP flow control with IOCP style async networking APIs here on my blog: [url="http://www.serverframework.com/asynchronousevents/2011/06/tcp-flow-control-and-asynchronous-writes.html"]http://www.serverframework.com/asynchronousevents/2011/06/tcp-flow-control-and-asynchronous-writes.html[/url]
  4. IO completion port

    I have some example IOCP code that you could download to play with. It provides some classes which wrap up the complexity somewhat. You can get the code from here: [url="http://www.serverframework.com/products---the-free-framework.html"]http://www.serverframework.com/products---the-free-framework.html[/url] There are also links to the code project articles that I wrote about this code back in 2002.
  5. Failed IOCP attempt

    If you want to get up to speed on IOCP in general you might find my free IOCP client/server code of some use, it's pretty old now but it works well and the articles that I wrote for CodeProject explain what's going on. You can download the code from [url="http://www.serverframework.com/products---the-free-framework.html"]here[/url] and there are links to the articles that explain it.