Logo
~Sockets~
~Examples~
~Contact~


InternalSocket.cpp

Go to the documentation of this file.
00001 #include "InternalSocket.h"
00002 #include "SlaveSocket.h"
00003 
00004 
00005 
00006 InternalSocket::InternalSocket(ISocketHandler& h,SlaveSocket *p,unsigned short id)
00007 :TcpSocket(h)
00008 ,m_parent(p)
00009 ,m_id(id)
00010 {
00011 }
00012 
00013 
00014 InternalSocket::~InternalSocket()
00015 {
00016 }
00017 
00018 
00019 void InternalSocket::OnRawData(const char *buf,size_t len)
00020 {
00021 printf("InternalSocket::OnRawData size %u\n", len);
00022         if (Handler().Valid(m_parent))
00023         {
00024                 m_parent -> SendCmd(m_id, S2M_DATA, len);
00025                 m_parent -> SendBuf(buf, len);
00026         }
00027         ibuf.Remove(ibuf.GetLength());
00028 }
00029 
00030 
00031 void InternalSocket::OnConnect()
00032 {
00033         if (Handler().Valid(m_parent))
00034         {
00035                 m_parent -> SendCmd(m_id, S2M_CONNECT);
00036         }
00037 }
00038 
00039 
00040 void InternalSocket::OnDelete()
00041 {
00042         if (Handler().Valid(m_parent))
00043         {
00044                 m_parent -> SendCmd(m_id, S2M_DISCONNECTED);
00045         }
00046 }
00047 
00048 
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4