Solved

I/O Completion Ports Code For a Server

Posted on 2004-04-11
3
619 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 clear a vector as well as how to detect empty vectors in C++.

708 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

18 Experts available now in Live!

Get 1:1 Help Now