IOCP server class
Hi all,
im currently writing a IOCP (IO completion port) server class and hope to one day possibly make it open source :-) .. im currently having some minor probs and also wanted to know if anyone had a better was to go about implementing it..
How its coded so far..
* Currently there are 2*CPU no worker threads checking IOCompletions
* When a client connects it allocates memory for the buffer etc for it, or if there is a old structure which isnt being used anymore (been placed on a re-use list) then it used that (this just saves deallocating the memory and then reallocating it
* When a client disconnects it puts the allocated buffer etc structure onto a list of these structures to be re-used
* When the server recieves data, it places the data at the end of the recieving sockets buffer and checks if a full message is recieved (checks for something like a null terminator or whatever)
* When the server has recieved a full message it is placed on a message queue which can be checked from the main thread
* If the server exceads its buffer space without recieving a full message it closes the socket and the buffer etc is again placed on the re-use list
So any ideas on improvements?
The problem
When a client runs out of beffer space, and therefore closes it self.. when its memory is re-used it works fine untill the program closes, which crashes when i try to free part of the re-used memory ??
I have made as sure as possible that the memory was never freed (i even have a debug library i wrote which logs every allocate and deallocate) so i dont know why the free fails. Also note its only when the buffer has been filled and then the socket closed.. if the client closes the connection then the memory is fine
any ideas ??
thanks all... if anyone wants to help Please then please email me and ill send the code with the error :-)
thanks a lot
~Wrathgame
lukejedikt@hotmail.com
~ Tim
Ok.. i worked out the problem :-) dont you hate that ?
anyway.. still interested in any ideas/anvanced features of IOCP you know about.. any warning etc etc :-)
~Wrathgame
anyway.. still interested in any ideas/anvanced features of IOCP you know about.. any warning etc etc :-)
~Wrathgame
~ Tim
I see all the people with knowledge of IOCP (ie direwolf) appears to have left this forum :-/ ah well its a shame.. i worked it out not thought.
If anyones interested in IOCP then drop me a message ;-)
~ wrthgame
If anyones interested in IOCP then drop me a message ;-)
~ wrthgame
~ Tim
I''m certainly interested, but I''ve been busy with work and haven''t been around much lately.
What are you doing on machines that don''t support IOCPs? Win9x probably makes up a considerable amount of the user base for the average desktop application.
Matt
What are you doing on machines that don''t support IOCPs? Win9x probably makes up a considerable amount of the user base for the average desktop application.
Matt
Matt
the IOCP is only server side, so as long as the server is run on a win 2000/XP machine then it doesnt matter what the clients running on ;-) they can have a linux version even. IOCP would only ever actually be usefull for a server as its main feature is scalability (ie can handle from 1 to thousands of connections)
~wrathgame
~wrathgame
~ Tim
Bah, I haven''t left...just extremely busy porting applications over to .NET and C#. ![](smile.gif)
And yes, I did get your email. Just haven''t had a chance to respond.
Dire Wolf
www.digitalfiends.com
![](smile.gif)
And yes, I did get your email. Just haven''t had a chance to respond.
Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement