Click here to Skip to main content
15,917,568 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Sending from one client to another client Pin
Rickard Andersson206-May-02 0:23
Rickard Andersson206-May-02 0:23 
GeneralRe: Sending from one client to another client Pin
6-May-02 0:51
suss6-May-02 0:51 
GeneralRe: Sending from one client to another client Pin
Rickard Andersson206-May-02 2:44
Rickard Andersson206-May-02 2:44 
GeneralRe: Sending from one client to another client Pin
6-May-02 3:03
suss6-May-02 3:03 
GeneralRe: Sending from one client to another client Pin
Rickard Andersson206-May-02 3:44
Rickard Andersson206-May-02 3:44 
GeneralRe: how posting code in this forum? Pin
6-May-02 4:03
suss6-May-02 4:03 
GeneralRe: how posting code in this forum? Pin
Chris Losinger6-May-02 4:11
professionalChris Losinger6-May-02 4:11 
GeneralRe: Sending from one client to another client Pin
6-May-02 6:06
suss6-May-02 6:06 
Here a very short snip when using CAsyncSocket, shortened:

typedef CList<CSocketNode*, CSocketNode*> CSocketNodeList;
CSocketNodeList m_NodesList;
CCriticalSection m_NodesListAccess;

// New client tries to connect to server's listening port
void CSocketServer::OnAccept(int nErrorCode) 
{
	ASSERT(!nErrorCode);

		//create a new node socket	
	CSocketNode* pSocket = new CSocketNode(this);

		//accept incoming socket and connect to a node socket
	if (Accept(*pSocket))
	{
		//add socket to internal list
		m_NodesListAccess.Lock();
		m_NodesList.AddTail(pSocket);
		m_NodesListAccess.Unlock();
	} else {
		//catch socket errors
		delete pSocket;
		return;
	}
}


Removing dead sockets is then later done with...
//POSITION pos = position of dead socket
m_NodesListAccess.Lock();
delete m_NodesList.GetAt(pos);
m_NodesList.RemoveAt(pos);
m_NodesListAccess.Unlock();

Hope it helps......
QuestionRE: Set ComboBox Values ? Pin
Aoife5-May-02 22:31
Aoife5-May-02 22:31 
AnswerRe: RE: Set ComboBox Values ? Pin
Sonu Kapoor5-May-02 22:35
Sonu Kapoor5-May-02 22:35 
GeneralRe: RE: Set ComboBox Values ? Pin
Aoife6-May-02 1:36
Aoife6-May-02 1:36 
GeneralRe: RE: Set ComboBox Values ? Pin
Sonu Kapoor6-May-02 2:07
Sonu Kapoor6-May-02 2:07 
GeneralRe: RE: Set ComboBox Values ? Pin
Aoife6-May-02 4:14
Aoife6-May-02 4:14 
GeneralRe: RE: Set ComboBox Values ? Pin
Sonu Kapoor6-May-02 5:51
Sonu Kapoor6-May-02 5:51 
GeneralMessenger type app in VC++ Pin
unknown soldier5-May-02 21:56
unknown soldier5-May-02 21:56 
Generalunable to execute database apps Pin
Bhikshapathi Gorantla5-May-02 21:37
Bhikshapathi Gorantla5-May-02 21:37 
GeneralSDI in Dll Pin
5-May-02 18:55
suss5-May-02 18:55 
QuestionHelp with _lfind? Pin
Learning5-May-02 17:47
Learning5-May-02 17:47 
AnswerRe: Help with _lfind? Pin
James R. Twine6-May-02 3:02
James R. Twine6-May-02 3:02 
Generalusing your own header in a cpp. Pin
SilverShalkin5-May-02 17:04
SilverShalkin5-May-02 17:04 
GeneralRe: using your own header in a cpp. Pin
Christian Graus5-May-02 17:31
protectorChristian Graus5-May-02 17:31 
GeneralRe: using your own header in a cpp. Pin
Paul M Watt5-May-02 19:32
mentorPaul M Watt5-May-02 19:32 
GeneralRe: using your own header in a cpp. Pin
SilverShalkin6-May-02 11:59
SilverShalkin6-May-02 11:59 
GeneralRe: using your own header in a cpp. Pin
Christian Graus6-May-02 12:21
protectorChristian Graus6-May-02 12:21 
GeneralRe: using your own header in a cpp. Pin
Paul M Watt6-May-02 13:15
mentorPaul M Watt6-May-02 13:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.