flat assembler
Message board for the users of flat assembler.

Index > Windows > using winsock with CreateIoCompletionPort

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 12741
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 17 Oct 2006, 19:26
could anyone guide me with the concept of CreateIoCompletionPort (using simple english, my english is bad)
what it is and how it works

and i saw some c and c++ code that after they created the worker thread (thread that would loop run GetQueuedCompletionStatus) using CreateThread, in the next line, they would use CloseHandle to close the thread handle, why?

i notice that CloseHandle doesn't quit/stop the created thread, so what is the usefullness on calling CloseHandle after CreateThread?

and what is the in/out Overlapped concept?

thank you in advance.
Post 17 Oct 2006, 19:26
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 18 Oct 2006, 11:02
CreateThread returns a HANDLE for the thread, which can be used for things like waiting until the thread terminates. If you don't use this handle, close it right away. If you use it, still remember to close it once the thread terminates. Otherwise you'll get a leak.

Haven't dealt with IOCP myself, so can't help you there - I dunno if www.madwizard.org got around to describing it in his socket tutorial.
Post 18 Oct 2006, 11:02
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12741
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 17 May 2009, 13:32
microsoft msdn acceptex() function provide some sample code regarding this function.

http://msdn.microsoft.com/en-us/library/ms737524(VS.85).aspx
Post 17 May 2009, 13:32
View user's profile Send private message Reply with quote
Biterider



Joined: 10 Apr 2005
Posts: 5
Location: Switzerland
Biterider 17 May 2009, 18:24
Hi
Recently I coded with some help a complete engine around IOCP using ObjAsm32. It is masm and OOP code, but you can use it as a reference to see how to use it. In the main file headers, you can find a collection of usefull links to some very interesting articles.
NetCom (name of the engine) is availabe as an update of the last ObjAsm32 release.

Biterider

_________________
ObjAsm32
Post 17 May 2009, 18:24
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12741
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 14 May 2011, 20:40
few years ago, 2006,
now, 2011, am attempting to do it again, i coded the iocp echo server (based on internet resource)

the problem now is,

how is that to close those socket.

example scenario.

user open up telnet localhost 80 to my sock server that listen on 80, then they just leave it like that, maybe key in a few characters then they idle.

how am i going to set it to close, force close that socket once i detect no more io operation in 10 seconds.

is that some option we could set on the accept socket?
Post 14 May 2011, 20:40
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 15 May 2011, 10:56
if the socket has done it's job and there's no use for it, yes close it. otherwise wait for clients.
Post 15 May 2011, 10:56
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12741
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 15 May 2011, 14:57
is there option for it to automatically close once idle for 10 seconds?

instead of "i try to code a polling" to check it?
Post 15 May 2011, 14:57
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.