Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mixing notification methods

Started by brekehan Mar 29, 2007 at 3:51 PM 2 replies 550+ views
Original Post
brekehan
brekehan
I don't know if it is possible in Winsock. I suspect that it is not, due to the problem of who gets notified when and in what order. If you know please explain: Has anyone ever come across a need or reason to mix blocking calls, non-blocking calls, event based calls, or IO-completion based calls on the same socket? If it was possible in theory, would you find that to be a valuable feature or more confusing? In what kind of situation would you use this feature? If you had differant sockets in one application, each with its own notification method, would you find it useful to group them together into a set that in turn had its own notification method? Example: you have a blocking socket and an event based socket that puts events into the windows message procedure. Would you ever group those two together and want to have a method of knowing when either has data ready to be received in addition to thier natural mechansims? [Edited by - brekehan on March 29, 2007 4:19:09 PM]
Antheus
Antheus
Quote:
Original post by brekehan
Has anyone ever come across a need or reason to mix blocking calls,
non-blocking calls, event based calls, or IO-completion based calls on the
same socket?


These are all the same, they all do the same thing. The only difference is the implementation and performance implications.

In the end, all of these feed into your own API one way or another, so that choice is irrelevant.

All of these boil down to two options - blocking calls and non-blocking calls, you cannot mix those two. The rest are API and system implementation specifics.

So, no, I don't see any case where it would be useful.

Unless you mean sockets bound to different ports, and each socket using its own strategy. That, of course, is possible, even viable. But changing strategies on one socket doesn't make much sense.

brekehan
brekehan
What about the grouping? Is there any situation where you would you group a blocking socket with a non-blocking socket; Or an event based with an IO-Completion based; etc?

Or do you always have a set of sockets that use the same notification mechanisms and in turn have the group use that same mechansim?

Antheus
Antheus
Quote:
Original post by brekehan
What about the grouping? Is there any situation where you would you group a blocking socket with a non-blocking socket; Or an event based with an IO-Completion based; etc?

Or do you always have a set of sockets that use the same notification mechanisms and in turn have the group use that same mechansim?


I don't really see how you could do that.

For a blocking socket you need to either process one at a time, or spawn one thread per socket. You also process the result as return value from the call.

For non-blocking, you have a thread, and you need to manage results based on various function calls. You also need to find a way to process them, ensure synchronization with other parts of application, and so on.

For IOCP based, you need to spawn worker threads, along with synchronization objects. They also depend on specific API.

All of these are completely different at all levels.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.