Google
Web alhem.net
Main Page | Alphabetical List | Class List | File List | Class Members | File Members

InSocket Class Reference

#include <InSocket.h>

Collaboration diagram for InSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InSocket (SocketHandler &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 SocketHandler &  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("159.153.196.60",8888);
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

OutSocket* InSocket::m_remote [private]
 

Definition at line 44 of file InSocket.h.

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

size_t InSocket::tmpl
 

Definition at line 41 of file InSocket.h.

Referenced by OnRawData().

char InSocket::tmps[32000]
 

Definition at line 40 of file InSocket.h.

Referenced by OnRawData().


The documentation for this class was generated from the following files:
Generated for C++ Sockets library example: simple tcp port proxy by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström