incubator-bluesky-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mabo...@apache.org
Subject svn commit: r1001701 [3/4] - in /incubator/bluesky/branches/apache-bluesky-realclass0.2.0: ./ TserverQT-0.2.0/
Date Mon, 27 Sep 2010 12:20:50 GMT
Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/adminserver.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/adminserver.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/adminserver.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/adminserver.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,230 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// AdminServer.h: interface for the CAdminServer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(ADMINSERVER_H)
+#define ADMINSERVER_H
+
+#define THREADCOUNT		1
+class CTCPPollThread;
+class CAsyncSocketEx;
+
+#include <list>
+#include "msgtype.h"
+#include "listencomm.h"
+#include "lissocket.h"
+#include "clientsocket.h"
+#include "multicomm.h"
+#include "jmutex.h"
+#include "error.h"
+#include <signal.h>  
+#include <arpa/inet.h>  
+#include <sys/types.h>  
+#include <sys/socket.h> 
+#include <sys/time.h>
+#include <unistd.h>  
+#include <netinet/in.h>  
+#include <netinet/ip.h>  
+#include <netinet/ip_icmp.h>  
+#include <netdb.h>  
+#include <setjmp.h> 
+#include <errno.h>
+class CLisSocket;
+
+//Client list
+typedef std::list<CRCLClient*> rclUserList;
+//teacher list
+typedef std::list<CRCLTeacher*> rclTeacherList;
+//MCU list
+typedef std::list<CRCLMCU*> rclMCUList;
+//SeMCU list
+typedef std::list<CRCLSeMCU*> rclSeMCUList;
+//room list
+typedef std::list<CRCLRoom*> rclRoomList;
+//IP list 
+typedef std::list<CRCLNodeIP*> rclIPList;
+//ID list 
+typedef std::list<DWORD> rclIDList;
+
+//node type,ID,name,IP,localIP
+typedef int(*NodeChangeNotify)(DWORD,DWORD,DWORD,char*,char*,char*);
+
+
+class CAdminServer
+{
+	friend class CLisSocket;
+	friend class CClientSocket;
+public:
+	int Init();
+	CAdminServer();
+	virtual ~CAdminServer();
+    int DataSent(DWORD);
+    BOOL IsComplete(std::string);
+    int rclSendMessage(DWORD,std::string);//send message to a ID with a string
+    int rclSendM();//send_thread send message
+    BOOL ParseRequest(CRCLMSG* pM, int event, SOCKET s, BOOL &bKeepAlive);
+    int GotConnection(SOCKET,char*,int);//user join
+    int Disconnect(SOCKET s);//delete a user
+private:
+	
+	int rclSendThreadHandle;//send_thread handle
+    NodeChangeNotify NodeInfoOut;//node information out
+    
+    JMutex umu;//user list 
+    JMutex tmu;//teacher list 
+    JMutex mmu;//MCU list 
+    JMutex smu;//seMCU list 
+    JMutex rmu;//room list 
+    JMutex imu;//IP list
+    JMutex dmu;//ID list 
+	JMutex Jtext_layoutC;
+	JMutex Jtext_layoutT;
+
+    DWORD hScan;
+    DWORD rclSysMax;// max number for system 
+    DWORD rclTeacherMax;//max teacher number
+    DWORD rclStudentMax;//max student number
+    DWORD rclGroupMax;//max group number
+
+
+
+public:
+	DWORD rclMCUChoose;//MCU choose mode
+	DWORD rclCurrentNum;
+	DWORD rclMaxNum;
+    DWORD rclAverageNum;
+    DWORD sum;
+    DWORD count;
+    BOOL bRun;
+
+public:
+	int rclGetIPSameA(char *ClientIP,char *MCUIP);
+    void rclDebugLog(char *log,char *vl="",int v2=0,int v3=0,int v4=0);
+ 
+    void rclScanSys();
+    int rclNodeChooseMCUIP(char* ip,char *pip,SOCKET s);
+    int rclGetIPSame(char *ClientIP,char *MCUIP);
+    int rclChooseMCU(DWORD cid,DWORD gid,SOCKET *ps,char *ip,DWORD *id);
+    int rclSeMCULeaveGroup(CRCLSeMCULeaveGroup *pMSG,SOCKET s);
+    void rclSeMCULeaveGroupLogout(DWORD SeMCUID,SOCKET s);
+    int rclSeMCUJoinGroup(CRCLSeMCUJoinGroup *pMSG,SOCKET s);
+    int rclSeMCULoginAndJoinGroup(DWORD SeMCUID,SOCKET s,int event);
+	int rclSeMCUGetGroupInfo(CRCLSeMCUGetGroupInfo *pMSG,SOCKET s);
+	int rclSeMCULogout(CRCLSeMCULogout *pMSG,SOCKET s);
+	int rclSeMCULogin(CRLCSeMCULogin *pMSG,SOCKET s,int event);
+	int rclTeacherGetClientList(CRCLTeacherGetClientList *pMSG,SOCKET s);
+
+    int rclTeacherSwitchMode(CRCLTeacherSwitchMode *pMSG,SOCKET s);
+	int rclTeacherCancelClientFocus(CRCLTeacherCancelClientFocus *pMSG,SOCKET s);
+	int rclTeacherAllowClientFocus(CRCLTeacherAllowClientFocus *pMSG,SOCKET s);
+	void rclResponseInfo(char *info);
+	int rclClientGetClientInfo(CRCLClientGetClientInfo *pMSG,SOCKET s);
+	int rclClientGetGroupInfo(CRCLClientGetCroupInfo *pMSG,SOCKET s);	
+	DWORD rclPopPushID(DWORD id);
+	int InitializeIDList(DWORD IDCount);
+	int rclResponseError(DWORD MSGType,SOCKET s,DWORD et);
+	int rclClientTextBroadcast(CRCLClientTextBroadcast *pMSG,SOCKET s);
+	int rclClientDestroyFocus(CRCLClientDestroyFocus *pMSG,SOCKET s);	
+	int rclClientApplyFocus(CRCLClientApplyFocus *pMSG,SOCKET s);
+	int rclTeacherTextBroadcast(CRCLTeacherTextBroadcast *pMSG,SOCKET s);
+	int rclMCULeaveGroup(CRCLMCULeaveGroup *pMSG,SOCKET s);
+	int rclSendResponse(char* pbuf,DWORD len,SOCKET* s,DWORD nums);
+	int rclMakePacket(char *pResponse,char *pRes,DWORD len);
+	int rclClientLogout(CRCLClientLogout *pMSG,SOCKET s);	
+	int rclClientLeaveGroup(CRCLClientLeaveGroup *pMSG,SOCKET s);
+	int rclClientJoinGroup(CRCLClientJoinInGroup *pMSG,SOCKET s);
+	int rclTeacherLeaveGroup(CRCLDestroyGroup *pMSG,SOCKET s);
+	int rclTeacherCreateGroup(CRCLCreateGroup *pMSG,SOCKET s);
+	int rclClientLogin(CRCLClientLogin *pMSG,SOCKET s,int event);
+	int rclMCULogout(CRCLMCULogout *pMSG,SOCKET s);
+	int rclMCULogin(CRCLMCULogin *pMSG,SOCKET s,int event);
+	int rclTeacherLogout(CRCLTeacherLogout *pMSG,SOCKET s);
+	int rclTeacherLogin(CRCLTeacherLogin *pMSG,SOCKET s,int event);	
+	int rclUserSendTextToGroup(DWORD userid,DWORD groupid,std::string text,int flag);	
+	int rclUserSendTextToUser();
+	int rclTeacherChat(CRCLTeacherChat *pMSG ,SOCKET s);
+	int rclBroadCast(DWORD);
+	void pingtest();
+		
+	void* statistics(int signo);  
+	unsigned short cal_chksum(unsigned short *addr,int len);  
+	int pack(int pack_no);  
+	void send_packet(void);  
+	void recv_packet(void);  
+	int unpack(char *buf,int len);  
+	void tv_sub(struct timeval *out,struct timeval *in); 
+	
+	void rclShowTeacherInfo();
+	void rclShowUserInfo();
+	void rclShowMCUInfo();
+	void rclShowSeMCUInfo();
+	void rclShowRoomInfo();
+	void rclShowIPInfo();
+	void rclShowIDInfo();
+	void rclShowFocusInfo();
+	
+	void rclShutdown();
+
+	
+	long rclSThreadEvent;
+
+	DWORD rclSendThreadID;
+
+	
+	rclUserList UserList;
+
+	
+	rclTeacherList TeacherList;
+
+	
+	rclMCUList MCUList;
+
+	
+	rclSeMCUList SeMCUList;
+
+	
+	rclRoomList RoomList;
+	
+	
+	rclIPList IPList;
+	rclIPList IPList2;
+	
+	
+	rclIDList IDList;
+	
+	
+	
+public:
+	DWORD ListenPort;
+	DWORD MaxOnline;
+	DWORD MaxTeacherOnline;
+	DWORD MaxStudentOnline;
+	DWORD MCUChoose;
+	DWORD ClientTalk;
+	char ReplaceText[1024];
+	CMultiComm m_accept[THREADCOUNT];
+	CListenComm m_listen;
+protected:
+private:
+
+	CLisSocket m_listemsocket;
+};
+
+#endif // !defined(ADMINSERVER_H)

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,286 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+// AsyncSocketEx.cpp: 
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "asyncsocketex.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CAsyncSocketEx::CAsyncSocketEx()
+{
+	m_SocketData.hSocket=INVALID_SOCKET;
+	m_SocketData.nSocketIndex=-1;
+	m_lEvent = 0;
+}
+
+CAsyncSocketEx::~CAsyncSocketEx()
+{
+	Close();
+}
+
+BOOL CAsyncSocketEx::Create( UINT nSocketPort /*=0*/, int nSocketType /*=SOCK_STREAM*/, LPCTSTR lpszSocketAddress /*=NULL*/ )
+{
+
+	SOCKET hSocket=socket(AF_INET, nSocketType, 0);
+	if (hSocket==INVALID_SOCKET)
+		return false;
+	m_SocketData.hSocket=hSocket;
+	int one =1;
+	if(!SetSockOpt(SO_REUSEADDR, (char *) &one, sizeof(int), SOL_SOCKET))
+		printf("error\n");
+	if (!Bind(nSocketPort, lpszSocketAddress))
+	{
+		Close();
+		return false;
+	}
+	return true;
+}
+
+BOOL CAsyncSocketEx::Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress)
+{
+	SOCKADDR_IN sockAddr;
+	memset(&sockAddr,0,sizeof(sockAddr));
+
+	LPSTR lpszAscii = (LPSTR)lpszSocketAddress;
+	sockAddr.sin_family = AF_INET;
+
+	if (lpszAscii == NULL)
+		sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+	else
+	{
+		DWORD lResult = inet_addr(lpszAscii);
+		if (lResult == INADDR_NONE)
+		{
+			return false;
+		}
+		sockAddr.sin_addr.s_addr = lResult;
+	}
+
+	sockAddr.sin_port = htons((u_short)nSocketPort);
+
+	return Bind((SOCKADDR*)&sockAddr, sizeof(sockAddr));
+}
+
+BOOL CAsyncSocketEx::Bind(const SOCKADDR* lpSockAddr, int nSockAddrLen)
+{
+	if (!bind(m_SocketData.hSocket, lpSockAddr, nSockAddrLen))
+		return true;
+	else
+		return false;
+}
+
+void CAsyncSocketEx::Close()
+{
+	if (m_SocketData.hSocket != INVALID_SOCKET)
+	{
+		if( close(m_SocketData.hSocket) == SOCKET_ERROR){
+			printf("\nclose socket error.");
+			return;
+		}
+		m_SocketData.hSocket=INVALID_SOCKET;
+		m_lEvent = 0;
+	}
+}
+
+BOOL CAsyncSocketEx::GetSockOpt(int nOptionName, void* lpOptionValue, int* lpOptionLen, int nLevel /* = SOL_SOCKET*/)
+{
+	int status;
+	if(m_SocketData.hSocket == 0)
+		return false;
+	
+	status = getsockopt(m_SocketData.hSocket, nLevel, nOptionName, lpOptionValue, (socklen_t*)lpOptionLen );
+	if (status != 0)
+		return false;
+	
+	return true;
+}
+
+BOOL CAsyncSocketEx::SetSockOpt(int nOptionName, const void* lpOptionValue, int nOptionLen, int nLevel /* = SOL_SOCKET*/)
+{
+	int status;
+	if(m_SocketData.hSocket == 0)
+		return false;
+	
+	status = setsockopt(m_SocketData.hSocket, nLevel, nOptionName, lpOptionValue, nOptionLen );
+	if (status != 0)
+		return false;
+	
+	return true;
+}
+	
+
+int CAsyncSocketEx::Receive(void* lpBuf, int nBufLen, int nFlags /*=0*/)
+{
+	return recv(m_SocketData.hSocket, (LPSTR)lpBuf, nBufLen, nFlags);
+}
+	
+
+int CAsyncSocketEx::Send(const void* lpBuf, int nBufLen, int nFlags /*=0*/)
+{
+	return send(m_SocketData.hSocket, (LPSTR)lpBuf, nBufLen, nFlags);
+}
+
+BOOL CAsyncSocketEx::Connect(LPCTSTR lpszHostAddress, UINT nHostPort)
+{
+
+	SOCKADDR_IN sockAddr;
+	memset(&sockAddr,0,sizeof(sockAddr));
+	
+	LPSTR lpszAscii = (LPSTR)lpszHostAddress;
+	sockAddr.sin_family = AF_INET;
+	sockAddr.sin_addr.s_addr = inet_addr(lpszAscii);
+	
+	if (sockAddr.sin_addr.s_addr == INADDR_NONE)
+	{
+	
+	}
+	
+	sockAddr.sin_port = htons((u_short)nHostPort);
+	
+	return CAsyncSocketEx::Connect((SOCKADDR*)&sockAddr, sizeof(sockAddr));
+}
+
+BOOL CAsyncSocketEx::Connect( const SOCKADDR* lpSockAddr, int nSockAddrLen )
+{
+	if(m_SocketData.hSocket == INVALID_SOCKET)
+		return false;
+	return SOCKET_ERROR!=connect(m_SocketData.hSocket, lpSockAddr, nSockAddrLen);
+}
+	
+
+BOOL CAsyncSocketEx::GetPeerName( SOCKADDR* lpSockAddr, int* lpSockAddrLen )
+{
+	if ( !getpeername(m_SocketData.hSocket, lpSockAddr, (socklen_t*)lpSockAddrLen) )
+		return true;
+	else
+		return false;
+}
+
+BOOL CAsyncSocketEx::GetSockName( SOCKADDR* lpSockAddr, int* lpSockAddrLen )
+{
+	if ( !getsockname(m_SocketData.hSocket, lpSockAddr, (socklen_t*)lpSockAddrLen) )
+		return true;
+	else
+		return false;
+}
+
+BOOL CAsyncSocketEx::ShutDown( int nHow /*=sends*/ )
+{
+	if ( !shutdown(m_SocketData.hSocket, nHow) )
+		return true;
+	else
+		return false;
+}
+
+SOCKET CAsyncSocketEx::Detach( )
+{
+	SOCKET socket=m_SocketData.hSocket;
+	m_SocketData.hSocket=INVALID_SOCKET;
+	m_lEvent = 0;
+	return socket;
+}
+
+BOOL CAsyncSocketEx::Attach( SOCKET hSocket, long lEvent /* = 0 */)
+{
+	if (hSocket==INVALID_SOCKET || !hSocket)
+		return false;
+
+	m_SocketData.hSocket=hSocket;
+	m_lEvent = lEvent;
+	return true;
+}
+
+BOOL CAsyncSocketEx::Listen( int nConnectionBacklog /*=5*/ )
+{
+	if (listen(m_SocketData.hSocket, nConnectionBacklog)==0)
+		return true;
+	else
+		return false;
+}
+
+BOOL CAsyncSocketEx::Accept( CAsyncSocketEx& rConnectedSocket, SOCKADDR* lpSockAddr /*=NULL*/, int* lpSockAddrLen /*=NULL*/ )
+{
+	
+	SOCKET hTemp = accept(m_SocketData.hSocket, lpSockAddr, (socklen_t*)lpSockAddrLen);
+
+	if (hTemp == INVALID_SOCKET)
+		return false;
+	rConnectedSocket.m_SocketData.hSocket=hTemp;
+	return true;
+}
+
+BOOL CAsyncSocketEx::IOCtl( long lCommand, DWORD* lpArgument )
+{
+	if ( !ioctl(m_SocketData.hSocket, lCommand, lpArgument) )
+		return false;
+	else
+		return true;
+}
+
+int CAsyncSocketEx::GetLastError()
+{
+
+	return -1;
+}
+
+
+SOCKET CAsyncSocketEx::GetSocketHandle()
+{
+	return m_SocketData.hSocket;
+}
+
+
+
+int CAsyncSocketEx::Poll()
+{
+	fd_set fdsetread;
+	struct timeval tv;
+
+	FD_ZERO(&fdsetread);
+	FD_SET(m_SocketData.hSocket,&fdsetread);
+	tv.tv_sec = 0;
+	tv.tv_usec = 10000;
+
+	
+	if (select(FD_SETSIZE,&fdsetread,0,0,&tv) < 0){
+		m_lEvent = -1;
+		return m_lEvent;
+	}
+	m_lEvent = 0;
+
+
+	if(FD_ISSET(m_SocketData.hSocket,&fdsetread)){
+
+
+			m_lEvent = 1;
+
+
+	}
+	return m_lEvent;
+}
+
+void CAsyncSocketEx::OnEvent()
+{
+
+	return ;
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/asyncsocketex.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,125 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// AsyncSocketEx.h: 
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+//#include "adminserver.h"
+#if !defined(ASYNCSOCKETEX_H)
+#define ASYNCSOCKETEX_H
+
+
+class CMultiComm ;
+class CListenComm;
+class CAsyncSocketEx  
+{
+	friend class CMultiComm;
+	friend class CListenComm;
+public:
+	virtual int Poll();
+	SOCKET GetSocketHandle();
+	/////////////////////////////////////
+	//Functions that imitate CAsyncSocket
+
+	//Construction
+	CAsyncSocketEx(); //Constructs a CAsyncSocket object
+	virtual ~CAsyncSocketEx();
+
+	//Creates a socket
+	BOOL Create(UINT nSocketPort = 0, 
+				int nSocketType = SOCK_STREAM,
+				LPCTSTR lpszSocketAddress = NULL );
+
+	//
+	inline long GetStatus(){ return m_lEvent;};
+	inline void SetStatus(long lEvent){ m_lEvent = lEvent;};
+	//Attaches a socket handle to a CAsyncSocket object
+	BOOL Attach( SOCKET hSocket, long lEvent=0);
+	
+	//Detaches a socket handle from a CAsyncSocket object
+	SOCKET Detach( );
+
+	//Gets the error status for the last operation that failed.
+	static int GetLastError();
+
+	//Gets the address of the peer socket to which the socket is connected
+	BOOL GetPeerName( SOCKADDR* lpSockAddr, int* lpSockAddrLen );
+
+	//Gets the local name for a socket
+	BOOL GetSockName( SOCKADDR* lpSockAddr, int* lpSockAddrLen );
+
+	//Retrieves a socket option
+	BOOL GetSockOpt(int nOptionName, void* lpOptionValue, int* lpOptionLen, int nLevel = SOL_SOCKET);
+
+	//Sets a socket option
+	BOOL SetSockOpt(int nOptionName, const void* lpOptionValue, int nOptionLen, int nLevel = SOL_SOCKET);
+	
+
+	//Operations
+
+
+	virtual void Close();
+	
+	
+	BOOL Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress);
+	BOOL Bind(const SOCKADDR* lpSockAddr, int nSockAddrLen);
+
+	virtual BOOL Connect(LPCTSTR lpszHostAddress, UINT nHostPort);
+	virtual BOOL Connect( const SOCKADDR* lpSockAddr, int nSockAddrLen );
+
+	BOOL Listen( int nConnectionBacklog = 5 );
+	virtual BOOL Accept( CAsyncSocketEx& rConnectedSocket, SOCKADDR* lpSockAddr = NULL, int* lpSockAddrLen = NULL );
+
+	
+	
+	BOOL IOCtl( long lCommand, DWORD* lpArgument );
+
+	
+	BOOL ShutDown( int nHow = sends );
+
+	
+	virtual int Receive(void* lpBuf, int nBufLen, int nFlags = 0);
+	virtual int Send(const void* lpBuf, int nBufLen, int nFlags = 0);
+
+	enum { receives = 0, sends = 1, both = 2 };
+
+
+protected:
+//	virtual void OnReceive(int nErrorCode){};
+//	virtual void OnSend(int nErrorCode){};
+//	virtual void OnConnect(int nErrorCode){};
+//	virtual void OnAccept(int nErrorCode){};
+//	virtual void OnClose(int nErrorCode){};
+	
+protected:
+	virtual void OnEvent();
+
+protected:	
+	struct t_AsyncSocketExData
+	{
+		SOCKET hSocket;
+		int nSocketIndex;
+	} m_SocketData;
+
+	long m_lEvent;
+
+};
+
+
+#endif // !defined(ASYNCSOCKETEX_H)

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,97 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+// ClientSocket.cpp: implementation of the CClientSocket class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "clientsocket.h"
+#include "adminserver.h"
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+extern CAdminServer server;
+CClientSocket::CClientSocket()
+{
+
+}
+
+CClientSocket::~CClientSocket()
+{
+	Close();
+}
+
+void CClientSocket::OnEvent()
+{
+	char recvbuffer[10000];
+	char caddr[50];
+    unsigned long len;
+	SOCKADDR lpSockAddr;
+    SOCKET s;
+	int iplen = sizeof(SOCKADDR);
+	BOOL rclb;
+	rclb = false;
+	if(m_lEvent == 0)			//no any event.
+		return;
+	IOCtl(FIONREAD, &len);
+	if(len==0){			//disconnect.
+		int ret = 1;
+
+		server.Disconnect(GetSocketHandle());
+		printf("read to close socket\n");
+		ShutDown(both);
+		while(ret>0){
+			ret = Receive(recvbuffer, 10000);	
+		}
+		Close();
+		printf("A client disconnected.\n");
+		return ;
+	}
+
+	s = GetSocketHandle();
+	if(GetPeerName(&lpSockAddr,&iplen))
+	{
+	SOCKADDR_IN* ip = (SOCKADDR_IN*)&lpSockAddr;
+		sprintf(caddr,"%d.%d.%d.%d",
+		        ((u_char*)&ip->sin_addr.s_addr)[0], 
+				((u_char*)&ip->sin_addr.s_addr)[1], 
+				((u_char*)&ip->sin_addr.s_addr)[2], 
+				((u_char*)&ip->sin_addr.s_addr)[3]);
+	server.GotConnection(s, caddr, ip->sin_port);		
+	printf("%s\n",caddr);
+
+	}
+	memset(recvbuffer, 0, 10000);
+	int recv_len = Receive(recvbuffer, 9999);
+	CRCLMSG* pM = (CRCLMSG*)recvbuffer;
+	int index = recv_len;
+	int packetlen = pM->msglen +8 - recv_len;
+	while(packetlen > 0)
+	{
+		recv_len = Receive(recvbuffer+index, packetlen);
+		printf("	recv a message lenth is %d\n",recv_len);
+		index += recv_len;
+		packetlen -= recv_len;
+	}
+	pM = (CRCLMSG*)recvbuffer;
+
+
+	if(!server.ParseRequest(pM, 1, s, rclb))
+		printf("parse failed\n");
+
+	return ;
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/clientsocket.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,24 @@
+// ClientSocket.h: interface for the CClientSocket class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(CLIENTSOCKET_H)
+#define CLIENTSOCKET_H
+
+
+#include "asyncsocketex.h"
+#include <string>
+class CClientSocket : public CAsyncSocketEx  
+{
+	//friend class CClientSocket;
+public:
+	CClientSocket();
+	virtual ~CClientSocket();
+
+protected:
+	virtual void OnEvent();
+
+};
+
+
+#endif // !defined(CLIENTSOCKET_H)

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/error.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/error.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/error.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/error.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,61 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+#define RCL_PASSWORD_ERROR						1	
+#define RCL_USER_AlREADY_ONLINE					2	
+#define RCL_MAX_USER								3	
+#define RCL_LOGIN_ERROR							4	
+#define RCL_MAX_TEACHER                          5   
+#define RCL_MAX_STUDENT		                    6   
+
+
+#define RCL_TEACHER_CREATE_GROUP_NOMCU			10	
+#define RCL_TEACHER_CREATE_GROUP_FAIL			11	
+#define RCL_MAX_GROUP							12	
+#define RCL_TEACHER_LEAVE_GROUP_FAIL				13	
+
+
+#define RCL_STUDENT_JOIN_GROUP_FAIL				20	
+#define RCL_STUDENT_LEAVE_GROUP_FAIL				21	
+#define RCL_STUDENT_GROUP_MAX_USER				22	
+
+
+#define RCL_MCU_LEAVE_GROUP_FAIL					30	
+
+
+#define RCL_STUDENT_APPLY_FOCUS_NO_TOKEN			40	
+#define RCL_STUDENT_APPLY_FOCUS_FAIL				41	
+#define RCL_STUDENT_KILL_FOCUS_FAIL				42	
+#define RCL_STUDENT_BROADCAST_TEXT_FAIL			43	
+
+
+#define RCL_TEACHER_BROADCAST_TEXT_FAIL			50	
+
+
+#define RCL_STUDENT_GET_GROUPLIST_FAIL			60	
+#define RCL_STUDENT_GET_CLIENTLIST_FAIL			61	
+
+
+#define RCL_TEACHER_ALLOW_FOCUS_EXIST			70 
+#define RCL_TEACHER_ALLOW_FOCUS_FAIL				71 
+
+
+#define RCL_TEACHER_CANCEL_FOCUS_NOT_EXIST		80 
+#define RCL_TEACHER_CANCEL_FOCUS_FAIl			81 
+
+
+#define RC_UNKNOW_ERROR							10001	

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jmutex.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jmutex.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jmutex.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jmutex.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,86 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+/*
+
+    This file is a part of the JThread package, which contains some object-
+    oriented thread wrappers for different thread implementations.
+
+    Copyright (c) 2000-2006  Jori Liesenborgs (jori.liesenborgs@gmail.com)
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef JMUTEX_H
+
+#define JMUTEX_H
+
+#if (defined(WIN32) || defined(_WIN32_WCE))
+	#ifndef _WIN32_WCE
+		#include <process.h>
+	#endif // _WIN32_WCE
+	#include <winsock2.h>
+	#include <windows.h>
+
+	//#define JMUTEX_CRITICALSECTION
+#else // using pthread
+	#include <pthread.h>
+#endif // WIN32
+
+#define ERR_JMUTEX_ALREADYINIT						-1
+#define ERR_JMUTEX_NOTINIT						-2
+#define ERR_JMUTEX_CANTCREATEMUTEX					-3
+
+class JMutex
+{
+public:
+	JMutex();
+	~JMutex();
+	int Init();
+	int Lock();
+	int Unlock();
+	bool IsInitialized() 						{ return initialized; }
+private:
+#if (defined(WIN32) || defined(_WIN32_WCE))
+#ifdef JMUTEX_CRITICALSECTION
+	CRITICAL_SECTION mutex;
+#else // Use standard mutex
+	HANDLE mutex;
+#endif // JMUTEX_CRITICALSECTION
+#else // pthread mutex
+	pthread_mutex_t mutex;
+#endif // WIN32
+	bool initialized;
+};
+
+#endif // JMUTEX_H

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jthread.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jthread.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jthread.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/jthread.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,93 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+/*
+
+    This file is a part of the JThread package, which contains some object-
+    oriented thread wrappers for different thread implementations.
+
+    Copyright (c) 2000-2006  Jori Liesenborgs (jori.liesenborgs@gmail.com)
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef JTHREAD_H
+
+#define JTHREAD_H
+
+#include "jmutex.h"
+
+#define ERR_JTHREAD_CANTINITMUTEX						-1
+#define ERR_JTHREAD_CANTSTARTTHREAD						-2
+#define ERR_JTHREAD_THREADFUNCNOTSET						-3
+#define ERR_JTHREAD_NOTRUNNING							-4
+#define ERR_JTHREAD_ALREADYRUNNING						-5
+
+class JThread
+{
+public:
+	JThread();
+	virtual ~JThread();
+	int Start();
+	int Kill();
+	virtual void *Thread() = 0;
+	bool IsRunning();
+	void *GetReturnValue();
+protected:
+	void ThreadStarted();
+private:
+
+#if (defined(WIN32) || defined(_WIN32_WCE))
+#ifdef _WIN32_WCE
+	DWORD threadid;
+	static DWORD WINAPI TheThread(void *param);
+#else
+	static UINT __stdcall TheThread(void *param);
+	UINT threadid;
+#endif // _WIN32_WCE
+	HANDLE threadhandle;
+#else // pthread type threads
+	static void *TheThread(void *param);
+	
+	pthread_t threadid;
+#endif // WIN32
+	void *retval;
+	bool running;
+	
+	JMutex runningmutex;
+	JMutex continuemutex,continuemutex2;
+	bool mutexinit;
+};
+
+#endif // JTHREAD_H
+

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,663 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+
+#include "languagechoose.h"
+
+
+
+//window_title
+#ifdef LANGUAGE_EN  
+ char *pwindow_title = "Server"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pwindow_title = "课堂服务中心";
+#endif
+
+ 
+//pmenu system
+#ifdef LANGUAGE_EN  
+ char *pmenu_system = "System"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pmenu_system = "系统";
+#endif 
+
+ 
+//pstart system
+#ifdef LANGUAGE_EN  
+ char *pstart_system = "Start"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstart_system = "启动";
+#endif 
+ 
+//exit system
+#ifdef LANGUAGE_EN  
+ char *pexit_system = "Quit"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pexit_system = "退出";
+#endif 
+ 
+//pcontrol
+#ifdef LANGUAGE_EN  
+ char *pcontrol = "Control"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pcontrol = "控制";
+#endif 
+ 
+//update
+#ifdef LANGUAGE_EN  
+ char *pupdate = "Update"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pupdate = "更新";
+#endif 
+ 
+//help
+#ifdef LANGUAGE_EN  
+ char *phelp = "Help"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *phelp = "帮助";
+#endif 
+ 
+//about
+#ifdef LANGUAGE_EN  
+ char *pabout = "About"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pabout = "关于";
+#endif 
+ 
+//server log
+#ifdef LANGUAGE_EN  
+ char *psever_log = "<b>Server Log</b>"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *psever_log = "<b>服务器日志</b>";
+#endif 
+ 
+//update button
+#ifdef LANGUAGE_EN  
+ char *pbutn_update = "Update"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pbutn_update = "更新";
+#endif 
+  
+//clear-button
+#ifdef LANGUAGE_EN  
+ char *pbutn_clear = "Clear"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pbutn_clear = "清空";
+#endif 
+  
+//user statistics
+#ifdef LANGUAGE_EN  
+ char *puser_statis = "Users Statistics"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *puser_statis = "<b>服务器用户统计</b>";
+#endif 
+  
+//current user number
+#ifdef LANGUAGE_EN  
+ char *pusernum = "Current Users  "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pusernum = "当前用户数目";
+#endif 
+  
+//maximum number
+#ifdef LANGUAGE_EN  
+ char *puser_maxnum = "Maximum Number "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *puser_maxnum = "最大用户数目";
+#endif 
+  
+//average number
+#ifdef LANGUAGE_EN  
+ char *pavenum = "Average Number "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pavenum = "平均用户数目";
+#endif 
+  
+//server online status
+#ifdef LANGUAGE_EN  
+ char *pserv_stat = "<b>Server Online Status</b>"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pserv_stat = "<b>服务器在线状况</b>";
+#endif 
+  
+//class ID
+#ifdef LANGUAGE_EN  
+ char *pclassID = "ClassID"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pclassID = "课堂ID";
+#endif 
+  
+//class name
+#ifdef LANGUAGE_EN  
+ char *pclassName = "ClassName"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pclassName = "课堂名称";
+#endif 
+  
+//teacher ID
+#ifdef LANGUAGE_EN  
+ char *pteacherID = "TeacherID"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacherID = "教师ID";
+#endif 
+  
+//rmcu_id
+#ifdef LANGUAGE_EN  
+ char *prmcu_id = "Main-MCU ID"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcu_id = "主MCU ID";
+#endif 
+  
+//	Focus studentID
+#ifdef LANGUAGE_EN  
+ char *pfocus_stuID = "Focus StudentID"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pfocus_stuID = "焦点学生ID";
+#endif 
+  
+//class
+#ifdef LANGUAGE_EN  
+ char *pclass = "Class"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pclass = "课堂";
+#endif 
+  
+//teacher name
+#ifdef LANGUAGE_EN  
+ char *pteacherName = "TeacherName"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacherName = "教师名称";
+#endif 
+  
+//teacherIP
+#ifdef LANGUAGE_EN  
+ char *pteacherIP = "TeacherIP"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacherIP = "教师IP";
+#endif 
+  
+//teacher
+#ifdef LANGUAGE_EN  
+ char *pteacher = "Teacher"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher = "教师";
+#endif 
+  
+//studentID
+#ifdef LANGUAGE_EN  
+ char *pstuID = "StudentID"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstuID = "学生ID";
+#endif 
+  
+//studen name
+#ifdef LANGUAGE_EN  
+ char *pstuName = "StudentName"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstuName = "学生名字";
+#endif 
+  
+//studentIP
+#ifdef LANGUAGE_EN  
+ char *pstuIP = "StudentIP"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstuIP = "学生IP";
+#endif 
+  
+//student
+#ifdef LANGUAGE_EN  
+ char *pstu = "Student"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu = "学生";
+#endif 
+  
+//rmcu_name
+#ifdef LANGUAGE_EN  
+ char *prmcu_name = "Main-MCU Name"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcu_name = "主MCU名称";
+#endif 
+  
+//rmcuIP
+#ifdef LANGUAGE_EN  
+ char *prmcuIP = "Main-MCU IP"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcuIP = "主MCU IP";
+#endif 
+  
+//rmcu
+#ifdef LANGUAGE_EN  
+ char *prmcu = "Main-MCU"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcu = "主MCU";
+#endif 
+  
+//semcu_id
+#ifdef LANGUAGE_EN  
+ char *psemcu_id = "Sed-MCU ID"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *psemcu_id = "辅MCU ID";
+#endif 
+  
+//semcu name
+#ifdef LANGUAGE_EN  
+ char *psemcu_name = "Sed-MCU Name"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *psemcu_name = "辅MCU名称";
+#endif 
+  
+//semcu_ip
+#ifdef LANGUAGE_EN  
+ char *psemcu_ip = "Sed-MCU IP"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *psemcu_ip = "辅MCU IP";
+#endif 
+  
+//semcu
+#ifdef LANGUAGE_EN  
+ char *psemcu = "Sed-MCU"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *psemcu = "辅MCU";
+#endif 
+  
+//ok
+#ifdef LANGUAGE_EN  
+ char *pok = "OK"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pok = "确定";
+#endif 
+  
+//version
+#ifdef LANGUAGE_EN  
+ char *pversion = "The Current Version is     "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pversion = "当前的版本号为     ";
+#endif 
+  
+//Initialization
+#ifdef LANGUAGE_EN  
+ char *pInit = "Initializing......\n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pInit = "初始化......\n";
+#endif 
+  
+//Started
+#ifdef LANGUAGE_EN  
+ char *pstarted = "System launched successfully!\n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstarted = "系统启动成功!\n";
+#endif 
+  
+//student send text message
+#ifdef LANGUAGE_EN  
+ char *pstu_sed_text = "Student %s sends text message. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_sed_text = "学生%s发送文本。";
+#endif 
+  
+//teacher login
+#ifdef LANGUAGE_EN  
+ char *pteacher_login = "Teacher %s lands system. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher_login = "教师%s登陆系统。";
+#endif 
+  
+//login error
+#ifdef LANGUAGE_EN  
+ char *perror001 = "Errors: Duplicate landing. \n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror001 = "错误:重复登陆。\n";
+#endif 
+  
+//error002
+#ifdef LANGUAGE_EN  
+ char *perror002 = "Error: The same username has sexist. \n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror002 = "错误:已有同名用户存在。\n";
+#endif 
+  
+//teacher logout
+#ifdef LANGUAGE_EN  
+ char *pteacher_logout = "Techer %s exits system. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher_logout = "教师%s退出系统。";
+#endif 
+  
+//rmcu login
+#ifdef LANGUAGE_EN  
+ char *prmcu_login = "Main-MCU lands system"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcu_login = "主MCU %s登陆系统。";
+#endif 
+  
+//error003
+#ifdef LANGUAGE_EN  
+ char *perror003 = "Error: MCU repeats landing\n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror003 = "错误:MCU重复登陆\n";
+#endif 
+  
+//error004
+#ifdef LANGUAGE_EN  
+ char *perror004 = "Error: There is the same name MCU exist"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror004 = "错误:已有同名MCU存在\n";
+#endif 
+  
+//rmcu logout
+#ifdef LANGUAGE_EN  
+ char *prmcu_logout = "Main-MCU %s exits system. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcu_logout = "主MCU %s退出系统。";
+#endif 
+  
+//student login
+#ifdef LANGUAGE_EN  
+ char *pstu_login = "Student %s logins system. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_login = "学生%s登陆系统。";
+#endif 
+  
+//error005
+#ifdef LANGUAGE_EN  
+ char *perror005 = "Error: There is the same name student exist. \n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror005 = "错误:学生重复登陆。\n";
+#endif 
+  
+//error006
+#ifdef LANGUAGE_EN  
+ char *perror006 = "Error: There is the same username exist. \n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror006 = "错误:已有同名用户存在。\n";
+#endif 
+  
+//student logout
+#ifdef LANGUAGE_EN  
+ char *pstu_logout = "Student %s exits system"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_logout = "学生%s退出系统。";
+#endif 
+  
+//teacher creat class
+#ifdef LANGUAGE_EN  
+ char *ptcher_crclass = "Teacher %s creats class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *ptcher_crclass = "教师%s创建课堂%s。";
+#endif 
+  
+//teacher cancel class
+#ifdef LANGUAGE_EN  
+ char *ptcher_canlclass = "Teacher %s cancels class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *ptcher_canlclass = "教师%s撤销课堂%s。";
+#endif 
+  
+//student join in class
+#ifdef LANGUAGE_EN  
+ char *pstu_join = "Student %s joins in class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_join = "学生%s加入课堂%s。";
+#endif 
+  
+//student leave classroom
+#ifdef LANGUAGE_EN  
+ char *pstu_out = "Student %s exits class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_out = "学生%s离开课堂%s。";
+#endif 
+  
+//rmcu leave classroom
+#ifdef LANGUAGE_EN  
+ char *prmcu_exit_class = "Main-MCU %s exit class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *prmcu_exit_class = "主MCU %s退出课堂%s。";
+#endif 
+  
+//teacher send message to group 
+#ifdef LANGUAGE_EN  
+ char *pteacher_send_groupmage = "Teaher %s send text-message to group. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher_send_groupmage = "教师%s向组内用户发送文本。";
+#endif 
+  
+//change to communication
+#ifdef LANGUAGE_EN  
+ char *pclass_commu = "Class %s swich to communication mode. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pclass_commu = "课堂%s切换到交互模式。";
+#endif 
+  
+//change to teaching
+#ifdef LANGUAGE_EN  
+ char *pclass_teach = "Class %s swich to teaching mode. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pclass_teach = "课堂%s切换到授课模式。";
+#endif 
+  
+//student appli
+#ifdef LANGUAGE_EN  
+ char *pstu_appli = "Student %s applicates to be focus. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_appli = "学生%s申请焦点。";
+#endif 
+  
+//student appli cancel
+#ifdef LANGUAGE_EN  
+ char *pstu_appli_cancel = "Student %s applicates to cancel his/her focus. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_appli_cancel = "学生%s请求撤销焦点。";
+#endif 
+  
+  
+//student send group message
+#ifdef LANGUAGE_EN  
+ char *pstu_send_groupmage = "Student %s sends text-message to group. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_send_groupmage = "学生%s在组内进行文本广播。";
+#endif 
+  
+  
+//student get class information
+#ifdef LANGUAGE_EN  
+ char *pstu_get_classinfo = "Student %s gets information of class. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_get_classinfo = "学生%s获取课堂信息。";
+#endif 
+  
+  
+//student get others information
+#ifdef LANGUAGE_EN  
+ char *pstu_get_stulist = "Student %s gets information of other students in the class. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pstu_get_stulist = "学生%s获取课堂内其他学生信息。";
+#endif 
+  
+  
+//teacher option rstudent
+#ifdef LANGUAGE_EN  
+ char *pteacher_option_rstu = "Teacher %s designats student %s as focus. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher_option_rstu = "教师%s指定学生%s为焦点。";
+#endif 
+  
+  
+//teacher cancel rstudent
+#ifdef LANGUAGE_EN  
+ char *pteacher_cancel_rstu = "Teacher %s cancels the foucs of student. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher_cancel_rstu = "教师%s撤销焦点。";
+#endif 
+  
+  
+//teacher get student list
+#ifdef LANGUAGE_EN  
+ char *pteacher_get_stulist = "Teacher %s gets the student-list of the group. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pteacher_get_stulist = "教师%s获取组内学生列表。";
+#endif 
+  
+  
+//assmcu login
+#ifdef LANGUAGE_EN  
+ char *pamcu_login = "Second layer MCU %s enter system. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pamcu_login = "辅MCU %s登陆系统。";
+#endif 
+  
+  
+//assmcu login failure
+#ifdef LANGUAGE_EN  
+ char *perror007 = "Error: Second layer MCU is landing repeatly. \n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror007 = "错误:辅MCU重复登陆。\n";
+#endif 
+  
+  
+//error008
+#ifdef LANGUAGE_EN  
+ char *perror008 = "Error: There is the same name second layer MCU existing. \n"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *perror008 = "错误:已有同名辅MCU存在。\n";
+#endif 
+  
+  
+//assmcu logout
+#ifdef LANGUAGE_EN  
+ char *pamcu_logout = "Second layer %s exits from system. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pamcu_logout = "辅MCU %s退出系统。";
+#endif 
+  
+  
+//assmcu get class information
+#ifdef LANGUAGE_EN  
+ char *pamcu_get_classinfo = "Second layer MCU %s gets information of the class. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pamcu_get_classinfo = "辅MCU %s获取课堂信息。";
+#endif 
+  
+  
+//assmcu join class
+#ifdef LANGUAGE_EN  
+ char *pamcu_join = "Second layer MCU %s joins in class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pamcu_join = "辅MCU %s加入课堂%s。";
+#endif 
+  
+  
+//assmcu exit class
+#ifdef LANGUAGE_EN  
+ char *pamcu_exit = "Second layer MCU %s exits from class %s. "; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pamcu_exit = "辅MCU %s退出课堂%s。";
+#endif 
+  
+  
+//allow chat
+#ifdef LANGUAGE_EN  
+ char *pallow_chat = "Swich to the mode that allows students chating"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pallow_chat = "切换到允许学生聊天模式";
+#endif 
+  
+  
+//forbid chat
+#ifdef LANGUAGE_EN  
+ char *pforbid_chat = "Swich to the mode that forbids students chating"; 
+#endif
+#ifdef LANGUAGE_CH
+ char *pforbid_chat = "切换到禁止学生聊天模式";
+#endif 
+ 

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/languagechoose.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,414 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+#ifndef _SOURCE_NAME_H_
+#define _SOURCE_NAME_H_
+ 
+#define LANGUAGE_EN  //choose language
+
+
+// window titile
+ extern char *pwindow_title ; 
+/////////////////////
+
+
+// menu system
+ extern char *pmenu_system ; 
+/////////////////////
+
+
+// start system
+ extern char *pstart_system ; 
+/////////////////////
+
+
+// 
+ extern char *pexit_system ; 
+/////////////////////
+
+
+// control
+ extern char *pcontrol ; 
+/////////////////////
+
+
+// update
+ extern char *pupdate ; 
+/////////////////////
+
+
+// help
+ extern char *phelp ; 
+/////////////////////
+
+
+// about
+ extern char *pabout ; 
+/////////////////////
+
+
+// sever log
+ extern char *psever_log ; 
+/////////////////////
+
+
+//update button  
+ extern char *pbutn_update ; 
+/////////////////////
+
+
+//clear-button 
+ extern char *pbutn_clear ; 
+/////////////////////
+
+
+// 
+ extern char *puser_statis ; 
+/////////////////////
+
+
+// 
+ extern char *pusernum ; 
+/////////////////////
+
+
+// 
+ extern char *puser_maxnum ; 
+/////////////////////
+
+
+// 
+ extern char *pavenum ; 
+/////////////////////
+
+
+// 
+ extern char *pserv_stat ; 
+/////////////////////
+
+
+// 
+ extern char *pclassID ; 
+/////////////////////
+
+
+// 
+ extern char *pclassName ; 
+/////////////////////
+
+
+// 
+ extern char *pteacherID ; 
+/////////////////////
+
+
+// 
+ extern char *prmcu_id ; 
+/////////////////////
+
+
+// 
+ extern char *pfocus_stuID ; 
+/////////////////////
+
+
+// 
+ extern char *pclass ; 
+/////////////////////
+
+
+// 
+ extern char *pteacherName ; 
+/////////////////////
+
+
+// 
+ extern char *pteacherIP ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher ; 
+/////////////////////
+
+
+// 
+ extern char *pstuID ; 
+/////////////////////
+
+
+// 
+ extern char *pstuName ; 
+/////////////////////
+
+
+// 
+ extern char *pstuIP ; 
+/////////////////////
+
+
+// 
+ extern char *pstu ; 
+/////////////////////
+
+
+// 
+ extern char *prmcu_name ; 
+/////////////////////
+
+
+// 
+ extern char *prmcuIP ; 
+/////////////////////
+
+
+// 
+ extern char *prmcu ; 
+/////////////////////
+
+
+// 
+ extern char *psemcu_id ; 
+/////////////////////
+
+
+// 
+ extern char *psemcu_name ; 
+/////////////////////
+
+
+// 
+ extern char *psemcu_ip ; 
+/////////////////////
+
+
+// 
+ extern char *psemcu ; 
+/////////////////////
+
+
+// 
+ extern char *pok ; 
+/////////////////////
+
+
+// 
+ extern char *pversion ; 
+/////////////////////
+
+
+// 
+ extern char *pInit ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_sed_text ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher_login ; 
+/////////////////////
+
+
+// 
+ extern char *perror001 ; 
+/////////////////////
+
+
+// 
+ extern char *perror002 ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher_logout ; 
+/////////////////////
+
+
+// 
+ extern char *prmcu_login ; 
+/////////////////////
+
+
+// 
+ extern char *perror004 ; 
+/////////////////////
+
+
+// 
+ extern char *prmcu_logout ; 
+/////////////////////
+
+
+// 
+ extern char *perror005 ; 
+/////////////////////
+
+
+// 
+ extern char *perror006 ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_logout ; 
+/////////////////////
+
+
+// 
+ extern char *ptcher_crclass ; 
+/////////////////////
+
+
+// 
+ extern char *ptcher_canlclass ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_join ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_out ; 
+/////////////////////
+
+
+// 
+ extern char *prmcu_exit_class ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher_send_groupmage ; 
+/////////////////////
+
+
+// 
+ extern char *pclass_commu ; 
+/////////////////////
+
+
+// 
+ extern char *pclass_teach ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_appli ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_appli_cancel ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_send_groupmage ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_get_classinfo ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_get_stulist ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher_option_rstu ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher_cancel_rstu ; 
+/////////////////////
+
+
+// 
+ extern char *pteacher_get_stulist ; 
+/////////////////////
+
+
+// 
+ extern char *pamcu_login ; 
+/////////////////////
+
+
+// 
+ extern char *perror007 ; 
+/////////////////////
+
+
+// 
+ extern char *perror008 ; 
+/////////////////////
+
+
+// 
+ extern char *pamcu_logout ; 
+/////////////////////
+
+
+// 
+ extern char *pamcu_get_classinfo ; 
+/////////////////////
+
+
+// 
+ extern char *pamcu_join ; 
+/////////////////////
+
+
+// 
+ extern char *pamcu_exit ; 
+/////////////////////
+
+
+// 
+ extern char *pallow_chat ; 
+/////////////////////
+
+
+// 
+ extern char *pstarted ; 
+/////////////////////
+
+
+// 
+ extern char *pforbid_chat ; 
+/////////////////////
+
+
+// 
+ extern char *perror003 ; 
+/////////////////////
+
+
+// 
+ extern char *pstu_login ; 
+/////////////////////
+
+ 
+#endif

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,64 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// LisSocket.cpp: implementation of the CLisSocket class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "lissocket.h"
+#include "clientsocket.h"
+#include "adminserver.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CLisSocket::CLisSocket()
+{
+
+}
+
+CLisSocket::~CLisSocket()
+{
+	ShutDown(both);
+	Close();
+
+}
+
+void CLisSocket::OnEvent()
+{
+	CClientSocket accept;
+	int count[THREADCOUNT];
+	int t, min;
+	if(m_lEvent == 1){		//Accept socket.
+		printf("\nLinstening.................");
+		if(Accept(accept)){
+			for(t=0; t<THREADCOUNT; t++){
+				count[t] = m_pServer->m_accept[t].GetCount();
+			}
+			for(t=0, min=0; t<THREADCOUNT; t++){
+				if(count[min] > count[t]) 
+					min = t;
+			}
+			if(m_pServer->m_accept[min].AddSocket(accept.Detach())){
+				printf("\nAccepted a connect................");
+			}
+		}
+	}
+	return ;
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/lissocket.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,39 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// LisSocket.h: interface for the CLisSocket class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(LISSOCKET_H)
+#define LISSOCKET_H
+
+#include "asyncsocketex.h"
+
+class CAdminServer;
+class CLisSocket : public CAsyncSocketEx  
+{
+public:
+	CLisSocket();
+	virtual ~CLisSocket();
+
+	CAdminServer* m_pServer;
+protected:
+	virtual void OnEvent();
+};
+
+#endif // !defined(LISSOCKET_H)

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,128 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// ListenComm.cpp: implementation of the CListenComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "asyncsocketex.h"
+#include "listencomm.h"
+
+#define SOCKETMUTEX_LOCK	{\
+							socketmutex.Lock();	\
+							}
+							
+
+#define SOCKETMUTEX_UNLOCK	{	\
+							socketmutex.Unlock();}
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CListenComm::CListenComm()
+{
+
+	m_socket = 0;
+}
+
+CListenComm::~CListenComm()
+{
+	m_socket = 0;
+}
+
+bool CListenComm::Init()
+{
+	if(!CTCPComm::Init())
+		return false;
+
+	if (!socketmutex.IsInitialized())
+	{
+		if (socketmutex.Init() < 0)
+			return false;
+	}
+
+	return true;
+}
+
+int CListenComm::OnPollThreadError(int status)
+{
+
+	return -1;
+}
+
+int CListenComm::Poll()
+{
+	int nRes;
+	SOCKETMUTEX_LOCK	
+
+	if(m_socket == 0){
+		SOCKETMUTEX_UNLOCK
+		return 0;
+	}
+
+	nRes = m_socket->Poll();
+	if(nRes < 0){
+		SOCKETMUTEX_UNLOCK
+		return nRes;
+	}
+
+	m_socket->SetStatus(nRes);
+
+	SOCKETMUTEX_UNLOCK
+	return nRes;
+}
+
+int CListenComm::PolledSocket()
+{
+
+	SOCKETMUTEX_LOCK	
+
+	if(m_socket == 0){
+		SOCKETMUTEX_UNLOCK
+		return 0;
+	}
+
+	m_socket->OnEvent();
+
+	SOCKETMUTEX_UNLOCK
+	return 1;
+}
+
+
+void CListenComm::Attach(CAsyncSocketEx* socket)
+{
+	SOCKETMUTEX_LOCK	
+
+	m_socket = socket;
+	SOCKETMUTEX_UNLOCK
+}
+
+CAsyncSocketEx* CListenComm::Detach()
+{
+	SOCKETMUTEX_LOCK	
+	CAsyncSocketEx* p = m_socket;
+	m_socket = 0;
+	SOCKETMUTEX_UNLOCK
+	return p;
+}
+
+void CListenComm::OnPollThreadStep()
+{
+	
+	usleep(200000);
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/listencomm.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,48 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// ListenComm.h: interface for the CListenComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(LISTENCOMM_H)
+#define LISTENCOMM_H
+
+#include "tcpcomm.h"
+#include "jmutex.h"
+
+class CListenComm : public CTCPComm  
+{
+public:
+	CAsyncSocketEx* Detach();
+	void Attach(CAsyncSocketEx* socket);
+	CListenComm();
+	virtual ~CListenComm();
+	virtual bool Init();
+
+protected:
+	virtual void OnPollThreadStep();
+	virtual int OnPollThreadError(int status);
+	virtual int PolledSocket();
+	virtual int Poll() ;
+
+private:
+	JMutex socketmutex;
+	CAsyncSocketEx* m_socket;
+};
+
+#endif // !defined(LISTENCOMM_H)

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/main.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/main.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/main.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/main.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,10 @@
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,21 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include "adminserver.h"
+CAdminServer server;
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent), ui(new Ui::MainWindow)
+{
+   // server.Init();
+
+    ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::StartTserver()
+{
+    server.Init();
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,25 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QtGui/QMainWindow>
+//#include "adminserver.h"
+//CAdminServer server;
+namespace Ui
+{
+    class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+    void StartTserver();
+private:
+    Ui::MainWindow *ui;
+};
+
+
+#endif // MAINWINDOW_H

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.ui
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.ui?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.ui (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/mainwindow.ui Mon Sep 27 12:20:49 2010
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>mainWindow</class>
+ <widget class="QMainWindow" name="mainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>600</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralWidget"/>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>600</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuStart">
+    <property name="title">
+     <string>Start</string>
+    </property>
+   </widget>
+   <addaction name="menuStart"/>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/msgtype.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/msgtype.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/msgtype.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/msgtype.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,807 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+#include "stdafx.h"
+#include <list>
+#include <string>
+#include "jmutex.h"
+#define ServerVersionID 0x10000000
+#define NAMELEN 200
+
+///////////////////////////////////////////////////////
+
+
+struct CRCLNodeIP 
+{
+	SOCKET s;
+	char IP[16];
+};
+
+
+struct CRCLClient 
+{
+	DWORD rclClientID;
+	SOCKET s;
+	char rclIP[16];
+	char rclLocalIP[16];
+	char rclName[NAMELEN];
+	char rclPass[16];
+	DWORD rclRoomID;
+	DWORD rclMCUID;
+	int ThreadEvent;
+
+	DWORD rclTAPort;
+	DWORD rclTVPort;
+	DWORD rclTSPort;
+	DWORD rclSAPort;
+	DWORD rclSVPort;
+	
+	DWORD rclIfSeMCU;
+	DWORD rclClientType;
+	
+	DWORD rclSeMCU_TAPort;
+	DWORD rclSeMCU_TVPort;
+	DWORD rclSeMCU_TSPort;
+	DWORD rclSeMCU_SAPort;
+	DWORD rclSeMCU_SVPort;
+};
+
+
+struct CRCLTeacher 
+{
+	DWORD rclTeacherID;
+	SOCKET s;
+	char rclIP[16];
+	char rclLocalIP[16];
+	int rclPort;
+	char rclName[NAMELEN];
+	char rclPass[16];
+	DWORD rclRoomID;
+	int ThreadEvent;
+
+	DWORD rclSAPort;
+	DWORD rclSVPort;
+	
+};
+
+
+struct CRCLMCU 
+{
+	DWORD rclMCUID;
+	SOCKET s;//MCU Socket
+	char rclIP[16]; 
+	char rclLocalIP[16];
+	//char rcPIP[16]; 
+	DWORD rclRoomID;//room ID
+	char rclName[NAMELEN];//MCU Name
+	char rclPass[16];//MCU Pass
+	int ThreadEvent;
+	
+	DWORD rclTAPort;
+	DWORD rclTVPort;
+	DWORD rclTSPort;
+	DWORD rclSAPort;
+	DWORD rclSVPort;
+	
+};
+
+
+struct CRCLSeMCU 
+{
+	DWORD rclMCUID;//MCUID
+	SOCKET s;//MCU Socket
+	char rclIP[16]; //MCU IP
+	char rclLocalIP[16];;//MCU Local IP
+	DWORD rclRoomID;//room ID
+	char rclName[NAMELEN];//MCU Name
+	char rclPass[16];//MCU Pass
+	DWORD rclType;
+	int ThreadEvent;
+	DWORD rclTransMCUID;
+		
+	DWORD rclTAPort;
+	DWORD rclTVPort;
+	DWORD rclTSPort;
+	DWORD rclSAPort;
+	DWORD rclSVPort;
+	
+};
+
+
+struct CRCLRoom 
+{
+	DWORD rclRoomID;
+	char rclName[128];
+	DWORD rclTeacherID;
+	DWORD rclMCUID;
+	DWORD rclFocusUserID;
+	JMutex cs;
+	JMutex ms;
+	
+	std::list<DWORD> rclUserRoom;
+	
+	std::list<DWORD> rclSeMCURoom;
+	int rclAllUser;
+	int rclNowUser;
+	int rclFocusUser;
+	
+	DWORD rclRoomMode;
+};
+
+
+struct CRCLLobby 
+{
+	std::string rclLobbyID;
+	int rclAllUser;
+	int rclNowUser;
+	std::list<DWORD> rclUserLobby;
+};
+
+
+struct CRCLSendMSG 
+{
+	SOCKET s;
+	std::string msg;
+};
+
+
+struct CRCLMSG 
+{
+	DWORD rclType;
+	DWORD msglen;
+	char msg[10000];
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+
+//ID : 5000
+struct CRCLTeacherLogin 
+{
+	char TeacherName[NAMELEN];
+	char TeacherPass[16];
+	char TeacherIP[16]; 
+};
+
+
+struct CRCLUserClassInfo 
+{
+	char ClassName[128];
+};
+
+
+//ID : 5001
+struct CRCLTeacherLoginR 
+{
+	DWORD ResponseType;
+	DWORD TeacherID;
+	DWORD ClassInfoReturn;
+	DWORD ClassInfoCount;
+	CRCLUserClassInfo ClassInfo[16];
+};
+
+
+//ID : 5010
+struct CRCLMCULogin 
+{
+	char MCUName[NAMELEN]; 
+	char MCUPass[16]; 
+	char MCUIP[16]; 
+	char MCUPIP[16];
+	DWORD TAPort; 
+	DWORD TVPort; 
+	DWORD TSPort;
+	DWORD CAPort; 
+	DWORD CVPort; 
+};
+
+
+//ID : 5011
+struct CRCLMCULoginR 
+{
+	DWORD ResponseType;
+	DWORD MCUID; //MCU ID
+};
+
+
+//ID : 5020
+struct CRCLClientLogin 
+{
+    char ClientName[NAMELEN];
+	DWORD ClientVersionID; 
+	char ClientPass[16];
+	char ClientIP[16];
+		 
+	DWORD SeMCU_TAPort;
+	DWORD SeMCU_TVPort;
+	DWORD SeMCU_TSPort; 
+	DWORD SeMCU_SAPort;
+	DWORD SeMCU_SVPort;			
+};
+
+
+struct CGroupInfo 
+{
+	DWORD GroupID; 
+	char GroupName[128]; 
+	char TeacherName[NAMELEN]; 
+};
+
+
+//ID : 5021
+struct CRCLClientLoginR 
+{
+	DWORD ResponseType; 
+	DWORD ClientID; 
+	DWORD ClientType; 
+};
+
+
+//ID : 5060
+struct CRLCSeMCULogin 
+{
+	char MCUName[NAMELEN];
+	char MCUPass[16];
+	char MCULocalIP[16];
+	DWORD TAPort; 
+	DWORD TVPort; 
+	DWORD TSPort; 
+	DWORD CAPort; 
+	DWORD CVPort; 
+};
+
+
+//ID : 5061
+struct CRCLSeMCULoginR 
+{
+	DWORD ResponseType;
+	DWORD MCUID;
+	DWORD MCUType;	
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////
+
+//ID : 10000
+struct CRCLCreateGroup 
+{
+	DWORD TeacherID; 
+	char GroupName[128]; 
+	DWORD CAPort; 
+	DWORD CVPort; 
+};
+
+
+//ID : 10001
+struct CRCLCreateGroupR 
+{
+	DWORD ResponseType;
+	DWORD GroupID; 
+	char MCUIP[16]; 
+	DWORD TAPort; 
+	DWORD TVPort; 
+	DWORD TSPort; 
+};
+
+
+//ID : 10002
+struct CRCLCreateGroupRMCU 
+{
+	DWORD GroupID;
+	DWORD TeacherID; 
+	char TeacherIP[16]; 
+	DWORD CAPort; 
+	DWORD CVPort; 
+	char GroupName[128]; 
+};
+
+
+//ID : 10010
+struct CRCLDestroyGroup 
+{
+	DWORD TeacherID;
+	DWORD GroupID;
+};
+
+
+//ID : 10011
+struct CRCLDestroyGroupR 
+{
+	DWORD ResponseType;
+};
+
+
+//ID : 10012
+struct CRCLDestroyGroupRClient 
+{
+	DWORD GroupID; 
+};
+
+
+//ID : 10020
+struct CRCLClientJoinInGroup 
+{
+	DWORD ClientID; 
+	DWORD GroupID; 
+	
+	DWORD TAPort; 
+	DWORD TVPort; 
+	DWORD TSPort; 
+	DWORD CAPort; 
+	DWORD CVPort; 
+	
+	
+};
+
+
+struct CClientInfo 
+{
+	DWORD ClientID;
+	char ClienName[NAMELEN];
+	DWORD IsFocus;	
+};
+
+
+//ID : 10021
+struct CRCLClientJoinInGroupR 
+{
+	DWORD ResponseType;
+	DWORD GroupID;
+	char MCUIP[16]; 
+	char SeMCUIP[16];
+	
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort; 
+	DWORD CVPort; 
+	
+		
+	
+	DWORD RoomMode; 
+};
+
+
+//ID : 10022
+struct CRCLClientJoinInGroupRAll 
+{
+	CClientInfo ClientInfo;
+};
+			
+
+
+//ID : 10023
+struct CRCLClientJoinInGroupRMCU 
+{
+	//DWORD ClientID;
+	char ClientIP[16]; 
+	
+	
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+
+	
+	CClientInfo ClientInfo;
+	//DWORD IfSeMCU;
+	DWORD ClientType;
+};
+
+
+//ID : 10024
+struct CRCLClientJoinInGroupRSeMCU
+{
+	DWORD ClientID;
+	char ClientIP[16];
+	
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+	
+};
+
+
+//ID : 10030
+struct CRCLClientLeaveGroup 
+{
+	DWORD ClientID;
+	DWORD GroupID;
+};
+
+
+//ID : 10031
+struct CRCLClientLeaveGroupR 
+{
+	DWORD ResponseType;
+	DWORD GroupID;
+};
+
+
+//ID : 10032
+struct CRCLClientLeaveGroupRAll 
+{
+	CClientInfo ClientInfo; 
+};
+
+
+
+
+
+//ID : 10040
+struct CRCLMCULeaveGroup 
+{
+	DWORD MCUID; //MCU ID
+	DWORD GroupID;
+};
+
+
+//ID : 10041
+struct CRCLMCULeaveGroupR 
+{
+	DWORD ResponseType;
+};
+
+
+//ID : 10042
+struct CRCLMCULeaveGroupRAll 
+{
+	DWORD GroupID; //³·Ïú×éµÄID
+};
+
+
+//ID : 10050
+struct CRCLClientGetCroupInfo 
+{
+	DWORD ClientID;
+};
+
+
+//ID : 10051
+struct CRCLClientGetCroupInfoR 
+{
+	DWORD ResponseType;
+	DWORD GroupCount;
+	DWORD TalkMode;
+	CGroupInfo GroupList[10];
+};
+
+
+//ID : 10060
+struct CRCLSeMCUGetGroupInfo 
+{
+	DWORD SeMCUID;
+};
+
+
+//ID : 10061
+struct CRCLSeMCUGetGroupInfoR
+{
+	DWORD ResponseType;
+	DWORD GroupCount;
+	CGroupInfo GroupList[10];
+};
+
+
+//ID : 10070
+struct CRCLSeMCUJoinGroup 
+{
+	DWORD SeMCUID;
+	DWORD GroupID;
+};
+
+
+//ID : 10071
+struct CRCLSeMCUJoinGroupR 
+{
+	DWORD ResponseType;
+	DWORD GroupID;
+	char MCUIP[16];
+
+	DWORD TAPort; 
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+
+
+
+};
+
+
+//ID : 10072
+struct CRCLSeMCUJoinGroupRToMCU 
+{
+	DWORD SeMCUID;
+	char SeMCUIP[16];
+	DWORD SeMCUType;
+	DWORD TAPort;
+	DWORD TVPort;
+	DWORD TSPort;
+	DWORD CAPort;
+	DWORD CVPort;
+};
+
+
+//ID : 10080
+struct CRCLSeMCULeaveGroup 
+{
+	DWORD SeMCUID;
+	DWORD GroupID;
+};
+
+
+//ID : 10081
+struct CRCLSeMCULeaveGroupR
+{
+	DWORD ResponseType;
+};
+
+
+//ID : 10082
+struct CRCLSeMCULeaveGroupRToClient 
+{
+	DWORD SeMCUID;
+};
+
+
+//ID : 10083
+struct CRCLSeMCULeaveGroupRToMCU 
+{
+	DWORD SeMCUID;
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+
+//ID : 5030
+struct CRCLTeacherLogout 
+{
+	DWORD TeacherID;
+};
+
+
+//ID : 5040
+struct CRCLMCULogout 
+{
+	DWORD MCUID;
+};
+
+
+//ID : 5050
+struct CRCLClientLogout 
+{
+	DWORD ClientID;
+};
+
+
+//ID : 5070
+struct CRCLSeMCULogout 
+{
+	DWORD MCUID;
+};
+
+//////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+
+//ID : 1000
+struct CRCLTeacherTextBroadcast 
+{
+	DWORD ClientID;
+	DWORD GroupID;
+	DWORD InfoLength; 
+	char Info[1024];
+};
+
+
+//ID : 1001
+struct CRCLTeacherTextBroadcastR
+{
+	char TeacherName[NAMELEN]; 
+	DWORD InfoLength;
+	char Info[1024]; 
+};
+
+
+//ID : 1010
+struct CRCLClientApplyFocus 
+{
+	DWORD ClientID;
+	DWORD GroupID;
+};
+
+
+//ID : 1011
+struct CRCLClientApplyFocusR 
+{
+	DWORD ResponseType;
+};
+
+
+//ID : 1012
+struct CRCLClientApplyFocusRToTM 
+{
+	DWORD FocusClientID;
+};
+
+
+//ID : 1020
+struct CRCLClientDestroyFocus 
+{
+	DWORD ClientID;
+	DWORD GroupID;
+};
+
+
+//ID : 1021
+struct CRCLClientDestroyFocusR
+{
+	DWORD ResponseType;
+};
+
+
+//ID : 1022
+struct CRCLClientDestroyFocusRToTM
+{
+	DWORD FocusClientID;
+};
+
+
+//ID : 1030
+struct CRCLClientTextBroadcast 
+{
+	DWORD ClientID;
+	DWORD GroupID;
+	DWORD InfoLength;
+	char Info[1024];
+};
+
+
+//ID : 1031
+struct CRCLClientTextBroadcastR
+{
+	char ClientName[NAMELEN];
+	DWORD InfoLength;
+	char Info[1024];
+};
+
+
+//ID : 1040
+struct CRCLClientGetClientInfo 
+{
+	DWORD ClientID;
+	DWORD GroupID;
+};
+
+
+//ID : 1041
+struct CRCLClientGetClientInfoR 
+{
+	DWORD ResponseType;
+	DWORD ClientCount;
+	CClientInfo ClientList[1024];
+};
+
+
+//ID : 1050
+struct CRCLTeacherAllowClientFocus
+{
+	DWORD TeacherID;
+	DWORD ClientID;
+	DWORD GroupID;
+};
+
+
+//ID : 1051
+struct CRCLTeacherAllowClientFocusR
+{
+	DWORD ResponseType;
+	DWORD ClientID;
+};
+
+
+struct CRCLTeacherAllowClientFocusRToMS
+{
+	DWORD ClientID;
+};
+
+
+//ID : 1060
+struct CRCLTeacherCancelClientFocus
+{
+	DWORD TeacherID;
+	DWORD ClientID;
+	DWORD GroupID;
+};
+
+
+//ID : 1061
+struct CRCLTeacherCancelClientFocusR
+{
+	DWORD ResponseType;
+	DWORD ClientID;
+};
+
+
+//ID : 1062
+struct CRCLTeacherCancelClientFocusRToMS
+{
+	DWORD ClientID;
+};
+
+
+//ID : 1070
+struct CRCLTeacherGetClientList 
+{
+	DWORD TeacherID;
+	DWORD RoomID;
+};
+
+
+
+//ID : 1071
+struct CRCLTeacherGetClientListR 
+{
+	DWORD ResponseType;
+	DWORD ClientNum;
+	CClientInfo ClientList[1024];
+};
+
+
+
+
+struct CRCLTeacherSwitchMode
+{
+	DWORD GroupID;
+	DWORD ModeType;  
+};
+
+
+
+struct CRCLTeacherSwitchModeR
+{
+	DWORD ModeType;
+};
+
+//ID:1090
+struct CRCLTeacherChat
+{
+	DWORD GroupID;
+	DWORD chat;
+};
+
+//ID:1091
+struct CRCLTeacherChatR
+{
+	DWORD ResponseType;
+};
+
+//ID:1092
+struct CRCLTeacherChatRtoS
+{
+	DWORD chat;
+};
+
+

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.cpp
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.cpp?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.cpp (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.cpp Mon Sep 27 12:20:49 2010
@@ -0,0 +1,184 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+
+// MultiComm.cpp: implementation of the CMultiComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include <list>
+
+#include "clientsocket.h"
+#include "multicomm.h"
+
+#define LISTMUTEX_LOCK		{	\
+							listmutex.Lock();	\
+							}
+							
+
+#define LISTMUTEX_UNLOCK	{\
+							listmutex.Unlock();}
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CMultiComm::CMultiComm()
+{
+
+}
+
+CMultiComm::~CMultiComm()
+{
+	ClearList();
+}
+
+bool CMultiComm::Init()
+{
+	if(!CTCPComm::Init())
+		return false;
+
+	if (!listmutex.IsInitialized())
+	{
+		if (listmutex.Init() < 0)
+			return false;
+	}
+
+	return true;
+}
+
+int CMultiComm::OnPollThreadError(int status)
+{
+	LISTMUTEX_LOCK
+	LISTMUTEX_UNLOCK
+	return -1;
+}
+
+void CMultiComm::OnPollThreadStep()
+{
+	
+
+	usleep(200000);
+}
+
+int CMultiComm::PolledSocket()
+{
+
+	CAsyncSocketEx* psocket = 0;
+	LISTMUTEX_LOCK
+	
+	SOCKETLIST::iterator index;
+	for(index=m_socketlist.begin(); index!=m_socketlist.end(); ++index){
+		psocket = *index;
+		if(psocket){
+			psocket->OnEvent();
+			if(psocket->GetSocketHandle() == INVALID_SOCKET){
+				*index = 0;
+				delete psocket;
+			}
+		}
+	}
+
+	m_socketlist.remove(0);
+	LISTMUTEX_UNLOCK
+	return 0;
+}
+int CMultiComm::Poll()
+{
+	int nRes;
+	CAsyncSocketEx* psocket = 0;
+	LISTMUTEX_LOCK
+	
+	SOCKETLIST::iterator index;
+
+	for(index=m_socketlist.begin(); index!=m_socketlist.end(); index++){
+		psocket = *index;
+		if(psocket){
+			nRes = psocket->Poll();
+			if(nRes<0){
+				LISTMUTEX_UNLOCK
+				return nRes;
+			}
+			psocket->SetStatus(nRes);
+		}
+	}
+
+	LISTMUTEX_UNLOCK
+	return 0;
+}
+
+void CMultiComm::ClearList()
+{
+	CClientSocket* p = 0;
+
+	SOCKETLIST::iterator index;
+
+	LISTMUTEX_LOCK
+
+	for(index=m_socketlist.begin(); index!=m_socketlist.end(); index++){
+		p = *index;
+		if(p){
+			delete p;
+		}
+	}
+
+	m_socketlist.clear();
+
+	LISTMUTEX_UNLOCK
+}
+
+bool CMultiComm::AddSocket(SOCKET socket)
+{
+	CClientSocket* p;
+	CClientSocket* psocket;
+	SOCKETLIST::iterator index;
+	if(socket == 0)
+		return true;
+
+	psocket = new CClientSocket;
+	if(psocket == 0)
+		return false;
+	psocket->Attach(socket, 0);
+
+	LISTMUTEX_LOCK
+
+	for(index=m_socketlist.begin(); index!=m_socketlist.end(); index++){
+		p = *index;
+		if(p){
+			if(p->GetSocketHandle() == socket){
+					LISTMUTEX_UNLOCK
+					return true;
+			}
+		}
+	}
+
+	m_socketlist.insert(m_socketlist.end(), psocket);
+	LISTMUTEX_UNLOCK
+	return true;
+}
+
+unsigned int CMultiComm::GetCount()
+{
+	unsigned int count;
+	LISTMUTEX_LOCK
+
+	count = m_socketlist.size();
+
+	LISTMUTEX_UNLOCK
+
+	return count;
+}

Added: incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.h
URL: http://svn.apache.org/viewvc/incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.h?rev=1001701&view=auto
==============================================================================
--- incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.h (added)
+++ incubator/bluesky/branches/apache-bluesky-realclass0.2.0/TserverQT-0.2.0/multicomm.h Mon Sep 27 12:20:49 2010
@@ -0,0 +1,54 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//with the License.  You may obtain a copy of the License at
+//
+//  http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License. 
+
+// MultiComm.h: interface for the CMultiComm class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(MULTICOMM_H)
+#define MULTICOMM_H
+
+#include "tcpcomm.h"
+#include "jmutex.h"
+
+typedef std::list<CClientSocket*>	SOCKETLIST;
+
+class CLisSocket;
+class CMultiComm : public CTCPComm  
+{
+	friend class CLisSocket;
+	friend class CClientSocket;
+public:
+	CMultiComm();
+	virtual ~CMultiComm();
+	virtual bool Init();
+
+protected:
+	virtual int OnPollThreadError(int status);
+	virtual int PolledSocket();
+	virtual int Poll() ;
+	virtual void OnPollThreadStep();
+public:
+	void ClearList();
+private:
+	unsigned int GetCount();
+	bool AddSocket(SOCKET socket);
+	JMutex listmutex;
+	SOCKETLIST m_socketlist;
+};
+
+#endif // !defined(MULTICOMM_H)



Mime
View raw message