News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Quick Question: whats faster?

Started by RedXVII, March 18, 2006, 02:16:10 AM

Previous topic - Next topic

RedXVII

Im making a program capable of handling alot of connections, 128+

Whats faster?

A windows message for each socket?

- OR -

One windowsmessage then a check for which socket it is?

Cheers  :U

realcr

I don't think it is a good idea to use windows messages for 128+ connections.
Maybe try using the select() function to handle connections.

realcr.

RedXVII

Me neither, i am using WSAAsyncselect. I discovered (i think) lParam is message type (FD_READ) and wParam is the socket which seems very handy =)

Will have to try this, because it means i can handle all connections with one WM. Im not sure what you mean by use select though...

Tedd

If you're using async sockets then I would go for a single WM_SOCK message, and identify the socket in there - only for program simplicity; I don't think either will actually be faster than the other. Although you could possibly try to use a lookup table rather than comparing against the list of sockets.

For your WM_SOCK message: LOWORD(lParam) = FD_READ/WRITE/etc, HIWORD(lParam) = error-code (0 if none), and wParam = socket-handle.

The "select" function allows you to check the status of many sockets all at once, so you could use this instead of setting up asyncselect.
And you can set sockets to non-blocking mode without going through asyncsel, using WSAIoctl.
No snowflake in an avalanche feels responsible.