/[H7]/trunk/H7 Server/TcpServerClass.cpp
ViewVC logotype

Contents of /trunk/H7 Server/TcpServerClass.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33 - (show annotations) (download)
Wed Jan 31 17:22:59 2007 UTC (17 years, 3 months ago) by hedin
File size: 625 byte(s)
Made the selection of baud rate work (well, make everything work - including multiple clients)
1 #include "StdAfx.h"
2 #include ".\tcpserverclass.h"
3
4 TcpServerClass::TcpServerClass(void)
5 {
6 }
7
8 TcpServerClass::~TcpServerClass(void)
9 {
10 }
11
12 void TcpServerClass::OnAccept(int nErrorCode)
13 {
14 typedef std::list<TcpClientClass*>::iterator ClientIt;
15
16 TcpClientClass* client = new TcpClientClass;
17 Accept(*client);
18 CSocket::OnAccept(nErrorCode);
19
20 mClients.push_back(client);
21
22 for (ClientIt it = mClients.begin(); it != mClients.end(); it++)
23 {
24 if ( (*it)->isClosed )
25 {
26 delete (*it);
27 mClients.erase(it);
28 //efter erase er iteratoren ikke længere valid
29 it = mClients.begin();
30 }
31 }
32
33 }

  ViewVC Help
Powered by ViewVC 1.1.20