Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC Networking VC10.0
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 25-Jun-11 22:58pm

1 solution

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

Solution 1

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!!!
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 4 Jul 2011
Copyright © CodeProject, 1999-2014
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