Logo
~Sockets~
~Examples~
~Contact~


InSocket Class Reference

#include <InSocket.h>

Collaboration diagram for InSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InSocket (ISocketHandler &h)
 ~InSocket ()
void OnAccept ()
void OnDelete ()
void OnRawData (const char *, size_t)

Public Attributes

char tmps [32000]
size_t tmpl

Private Attributes

OutSocketm_remote

Detailed Description

Definition at line 28 of file InSocket.h.


Constructor & Destructor Documentation

InSocket::InSocket ( ISocketHandler &  h  ) 

Definition at line 29 of file InSocket.cpp.

00030 :TcpSocket(h, 32000, 32000)
00031 ,tmpl(0)
00032 {
00033 }

InSocket::~InSocket (  ) 

Definition at line 36 of file InSocket.cpp.

00037 {
00038 }


Member Function Documentation

void InSocket::OnAccept (  ) 

Definition at line 41 of file InSocket.cpp.

References m_remote.

00042 {
00043         printf(" *** Remote Address: '%s'\n",GetRemoteHostname().c_str());
00044         m_remote = new OutSocket(Handler());
00045 //      m_remote -> Open("159.153.197.91",8888);
00046         m_remote -> Open("127.0.0.1",80);
00047         m_remote -> SetDeleteByHandler();
00048         m_remote -> SetRemote(this);
00049 //      sleep(1);
00050         Handler().Add(m_remote);
00051 }

void InSocket::OnDelete (  ) 

Definition at line 54 of file InSocket.cpp.

References m_remote.

00055 {
00056         if (Handler().Valid(m_remote))
00057         {
00058                 m_remote -> SetCloseAndDelete();
00059         }
00060 }

void InSocket::OnRawData ( const char *  ,
size_t   
)

Definition at line 63 of file InSocket.cpp.

References m_remote, tmpl, and tmps.

00064 {
00065         if (Handler().Valid(m_remote) && m_remote -> Ready())
00066         {
00067                 if (tmpl)
00068                 {
00069                         m_remote -> SendBuf(tmps, tmpl);
00070                         tmpl = 0;
00071                 }
00072                 m_remote -> SendBuf(p, l);
00073         }
00074         else
00075         {
00076                 Handler().LogError(this, "OnRawData", 0, "m_remote not ready");
00077                 memcpy(tmps + tmpl, p, l);
00078                 tmpl += l;
00079         }
00080 }


Member Data Documentation

char InSocket::tmps[32000]

Definition at line 40 of file InSocket.h.

Referenced by OnRawData().

Definition at line 41 of file InSocket.h.

Referenced by OnRawData().

Definition at line 44 of file InSocket.h.

Referenced by OnAccept(), OnDelete(), and OnRawData().


The documentation for this class was generated from the following files:
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