Logo
~Sockets~
~Examples~
~Contact~


Stdin Class Reference

#include <Stdin.h>

Inheritance diagram for Stdin:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Stdin (ISocketHandler &, size_t bufsize=1000)
virtual void OnData (const char *, size_t)=0

Protected Member Functions

void OnRead ()

Private Attributes

size_t m_bufsize

Detailed Description

File ......... Stdin.h Published .... 2004-07-03 Author ....... grymse@alhem.net

Definition at line 30 of file Stdin.h.


Constructor & Destructor Documentation

Stdin::Stdin ( ISocketHandler &  h,
size_t  bufsize = 1000 
)

File ......... Stdin.cpp Published .... 2004-07-03 Author ....... grymse@alhem.net

Definition at line 29 of file Stdin.cpp.

00029                                              : Socket(h)
00030 ,m_bufsize(bufsize)
00031 {
00032         Attach( STDIN_FILENO );
00033         Set(true, false, false);
00034 }


Member Function Documentation

virtual void Stdin::OnData ( const char *  ,
size_t   
) [pure virtual]

characters from stdin, including crlf's

Implemented in Stdin2.

Referenced by OnRead().

void Stdin::OnRead (  )  [protected]

Definition at line 37 of file Stdin.cpp.

References m_bufsize, and OnData().

00038 {
00039         char buf[m_bufsize];
00040         int n = read(GetSocket(), buf, m_bufsize + 1); //recv(0, buf, 1000, 0);
00041         if (n == -1)
00042         {
00043                 Handler().LogError(this, "OnRead", errno, strerror(errno), LOG_LEVEL_FATAL);
00044                 SetCloseAndDelete();
00045                 return;
00046         }
00047         OnData(buf, n);
00048 }


Member Data Documentation

size_t Stdin::m_bufsize [private]

Definition at line 42 of file Stdin.h.

Referenced by OnRead().


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