Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I'm writing code about a system that consist of a server handling multiple client connection.


https://docs.google.com/drawings/d/1IeZBO9jqxbXcZPvX6bsAjcM8O3L9KJW7C8UVELa-jUM/edit?hl=en_US
The link above is the image about the brief idea of how it works.


In the server I use a CDocument-derived class to manage the socket objects and data, as my computer has multiple network adapters, I need a link list to manage the server listening sockets.


I've got no problem of initializing the sockets to different adapters. But I have encounter a problem of passing the connection request to Client Socket list. I can override the Notification Functions(e.g. OnRecieve, OnAccept) but I don't know how to refer the action in the socket(for example changing the data of document class with the data received) back to the document class.


I'm using VS2010 on Windows 7 Ultimate.


Thank you very much.




Posted

1 solution

your socket class needs a member HWND to post (not send) user messages to the main Window that data is updated. Their can you process the data.

I strongly recommand you to divide your socket, document and view. Dont write spaghetti code you will regret it!!!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900