Solved

I/O Completion Ports Code For a Server

Posted on 2004-04-11
3
620 Views
Last Modified: 2007-12-19
Right, I have a program written in C++ that I want to turn into a MUD/RPG Server. i require the following

-Code that I can just plug in, with very little work
-Code that does not use the window message loop, as i do not have one in my app (console app)
-Code that actually works, and instructions on how to use it.
-An  explanation of how it works would be nice also.
-NOT MFC,ATL OR COM

NB. I have tried certain examples from the code project and they have not compiled, so I doubt they will be of any use


Thank You very much in advance, because I have spent hours and fruitless hours searching for what I cannot find.
0
Comment
Question by:Hyperon
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 10801316
Check out http://win32.mvps.org/network/sockhim.html ("Sockets, IOCPs, AcceptEx") and the accompanying code at http://win32.mvps.org/network/sockhim.zip
0
 
LVL 4

Assisted Solution

by:booki
booki earned 250 total points
ID: 10802022
Hyperon,

A "SocketServer" class with i/o worker threads that handle all socket reads and writes and non i/o worker threads to handle the business logic.  It implements all the requirements you have listed above.

"Writing a high performance server that runs on Windows NT and uses sockets to communicate with the outside world isn't that hard once you dig through the API references. What's more most of the code is common between all of the servers that you're likely to want to write. It should be possible to wrap all of the common code up in some easy to reuse classes. However, when I went looking for some classes to use to write my first socket server all of the examples and articles that I found required the user to pretty much start from scratch or utilise "cut and paste reuse" when they wanted to use the code in their own servers. Also the more complicated examples, ones that used io completion ports for example, tended to stop short of demonstrating real world usage. After all, anyone can write an echo server..."

Full Article and Code.
Article: http://www.developerfusion.com/show/2498/1/
Article: http://www.developerfusion.com/show/4444/
Source Code: http://www.developerfusion.com/files/f_4444.zip

b.

0
 

Author Comment

by:Hyperon
ID: 10803055
booki, i dont know, i just cant seem to grasp that code you've given, in any case, i dont really like wrapper classe, i hae to go and split them up later for my purposes that way. but, to be fair, this is what i asked for, so ill split the points
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now