One last IOCP question :)
-
Cancel Overlapped Socket Op Update: From a Larry Osterman (Microsoft engineer) blog, apparently you can use CancelIo(), casting your socket handle to a "HANDLE". Give it a try - worst that can happen is it fails :) Mark
CancelIo doesnt work, the thing is that it needs to be ran from the same thread where Overlapped operations were posted. I could however close the socket and open it again, but what are the drawbacks of this? this means that i need to close and open like 20 sockets per second in the future. looks really hard to me, but i cant really figure out what might happen when i do this.
-
CancelIo doesnt work, the thing is that it needs to be ran from the same thread where Overlapped operations were posted. I could however close the socket and open it again, but what are the drawbacks of this? this means that i need to close and open like 20 sockets per second in the future. looks really hard to me, but i cant really figure out what might happen when i do this.
Polity4h wrote:
CancelIo doesnt work, the thing is that it needs to be ran from the same thread where Overlapped operations were posted.
Yeah I thought about that since you are posting overlapped ops from your worker thread(s) :) 20 sockets per second? How long is the time you are willing to wait before the remote node is considered inactive??
-
Polity4h wrote:
CancelIo doesnt work, the thing is that it needs to be ran from the same thread where Overlapped operations were posted.
Yeah I thought about that since you are posting overlapped ops from your worker thread(s) :) 20 sockets per second? How long is the time you are willing to wait before the remote node is considered inactive??
alright, i might have thought a bid to far in the future were i got myself a mainframe ;) << -_- whatever, anyways, lets say 2 sockets needs to be created per second. wont this kill my system after doing this a long time ( my app needs to run constantly for, count them up a few years ) << thats the perfect vision ofcourse.
-
alright, i might have thought a bid to far in the future were i got myself a mainframe ;) << -_- whatever, anyways, lets say 2 sockets needs to be created per second. wont this kill my system after doing this a long time ( my app needs to run constantly for, count them up a few years ) << thats the perfect vision ofcourse.
I'm not sure what you are trying to do. Why do you need to keep creating sockets but never destroy them? Surely you'll run out of sockets if you do that :)
-
I'm not sure what you are trying to do. Why do you need to keep creating sockets but never destroy them? Surely you'll run out of sockets if you do that :)
...I could however close the socket and open it again, but what are the drawbacks of this? this means that i need to close and open like 20 sockets per second in the future... hehe, anyways your saying that your server wont suffer to hard when creating AND DESTROYING lets say 2 sockets per second?
-
...I could however close the socket and open it again, but what are the drawbacks of this? this means that i need to close and open like 20 sockets per second in the future... hehe, anyways your saying that your server wont suffer to hard when creating AND DESTROYING lets say 2 sockets per second?
No. As long as that's really what your app needs to do. :) Think about how many TCP sockets a busy web (HTTP) server must open and close per second. 20 per second is nothing :) Mark
-
No. As long as that's really what your app needs to do. :) Think about how many TCP sockets a busy web (HTTP) server must open and close per second. 20 per second is nothing :) Mark
-
...I could however close the socket and open it again, but what are the drawbacks of this? this means that i need to close and open like 20 sockets per second in the future... hehe, anyways your saying that your server wont suffer to hard when creating AND DESTROYING lets say 2 sockets per second?
*EDIT* Having a pool of sockets could improve performance - that way only ConnectEx/DisconnectEx needs to be called on a socket instead of recreating/destoying the entire socket every time. Mark
-
*EDIT* Having a pool of sockets could improve performance - that way only ConnectEx/DisconnectEx needs to be called on a socket instead of recreating/destoying the entire socket every time. Mark
src=msdn:The Windows Sockets ConnectEx function establishes a connection to a specified socket, and optionally sends data (called connect data) once the connection is established. The ConnectEx function is only supported on connection-oriented sockets. remember, i'm forced to use connectionless protocols :) thanks anyway
-
src=msdn:The Windows Sockets ConnectEx function establishes a connection to a specified socket, and optionally sends data (called connect data) once the connection is established. The ConnectEx function is only supported on connection-oriented sockets. remember, i'm forced to use connectionless protocols :) thanks anyway
Gotcha man :) I was just extending my comment about TCP sockets on an HTTP server :)