Click here to Skip to main content
13,047,567 members (59,292 online)
Rate this:
Please Sign up or sign in to vote.
I have a single asynchronous socket at my server side. whenever there is something to be read or written on the socket, a window's message is generated. Right now there is only one single asynchronous socket on the server that handles requests of more than one client I guess. But I am not sure will this work if number of clients exceed. If I need to handle 40 clients, do I need to create 40 asynchronous sockets at server side to handle request of each of the 40 clients simultaneoulsy? I am not sure how to extend this single server single client application to multiple clients application. Can anybody give me some guidlines how to move forward? below is the code I done at server side with a single asynchronous socket:
WSAAsyncSelect (socketIdentifier, hwnd, MY_MESSAGE_NOTIFICATION, FD_READ | FD_CONNECT | FD_CLOSE | FD_ACCEPT); //Making the socket Asynchronous
   while(GetMessage(&Msg, NULL, 0, 0) > 0) //Waiting for windows messages
   return Msg.wParam;

    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
           case MY_MESSAGE_NOTIFICATION: //Window message generated by asynchronous socket.
             switch (lParam) //If so, which one is it?
                case FD_ACCEPT:
                    //Connection request was made
                case FD_CONNECT:
                    //Connection was made successfully
                case FD_READ:
                case FD_CLOSE:
                    //Lost the connection
Posted 19-Apr-13 19:07pm
Updated 19-Apr-13 20:14pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This question has already been answered in your previous query at Binding 40 Sockets to 40 different IP addresses[^]. If you have further information then please respond to the person who gave you the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100