Tcl Speed Test 0.0
Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
TclSpeedTestServer Class Reference

This class implements the Tcl Speed Test Server. More...

List of all members.

Public Member Functions

 TclSpeedTestServer (name,...)
 ~TclSpeedTestServer ()
 HttpdRead ()
 HttpdRespond ()
 HttpdError (code)
 Httpd_Log (reason,...)
 SendRandomTextData (bytes)

Static Private Member Functions

static LogPuts (level, message)
static HttpdAccept (newsock, ipaddr, remport)
static HttpdDate (clicks)
static randomprintable ()

Private Attributes

 state
 proto
 url
 query
 mime

Static Private Attributes

static version
static defaultport
static port
static bindhost
static default
static bufsize
static sockblock
static host
static defaultlogfilename
static logfilename
static defaultpidfilename
static pidfilename
static listen
static accepts
static testbuffer
static logchan
static HttpdErrors
static HttpdErrorFormat

Detailed Description

This class implements the Tcl Speed Test Server.

* The static members implement global initialization and the listener. The class instances are client connections.

Adapted from the simple HTTPD server that is included in sdx, by Stephen Uhler / Brent Welch (c) 1996 Sun Microsystems.

Main changes: 1) Hardwired the data. This server never touches the file system, except for a PID file and a log file. It never serves files and does no CGI or cookies, etc. It only sends random data in 1, 2, 4, 8, 16, 32, etc. megabyte chunks. 2) It does nothing with the POST or GET query, but will accept an arbitrary abount of data uploaded.

Basicaly it is a like /dev/random (GET) and /dev/null (POST). And I reimplemented the server to use a SNIT type object instead of global variables and upvar.

Author:
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

TclSpeedTestServer::TclSpeedTestServer ( name  ,
  ... 
)

Create a connection object.

Parameters:
...options:
  • -sock The connection socket.
  • -remaddr The remote address.
  • -remport The remote port.
TclSpeedTestServer::~TclSpeedTestServer ( )

Destory (close) a connection.


Member Function Documentation

TclSpeedTestServer::Httpd_Log ( reason  ,
  ... 
)

Log an Httpd transaction.

Parameters:
reasonThe reason for the log message.
...Additional arguments.
static TclSpeedTestServer::HttpdAccept ( newsock  ,
ipaddr  ,
remport   
) [static, private]

Accept a connection.

Parameters:
newsockConnection socket.
ipaddrRemote IP address.
remportRemote port.
static TclSpeedTestServer::HttpdDate ( clicks  ) [static, private]

Generate a date string in HTTP format.

Parameters:
clicksCurrent time in seconds.
TclSpeedTestServer::HttpdError ( code  )

Display (send) a error message.

Parameters:
codeHTTP error code.
TclSpeedTestServer::HttpdRead ( )

Read from a connection.

TclSpeedTestServer::HttpdRespond ( )

Respond to a request.

static TclSpeedTestServer::LogPuts ( level  ,
message   
) [static, private]

Log output function.

Parameters:
levelLevel of log message.
messageThe message text.
static TclSpeedTestServer::randomprintable ( ) [static, private]

Generate a random printable character.

Returns:
A single printable character.
TclSpeedTestServer::SendRandomTextData ( bytes  )

Send some random data.

Parameters:
bytesThe number of bytes to send.

Member Data Documentation

TclSpeedTestServer::accepts [static, private]

Accept count.

TclSpeedTestServer::bindhost [static, private]

The host or ip to bind to (-bindhost CLI option).

TclSpeedTestServer::bufsize [static, private]

The buffer size.

TclSpeedTestServer::default [static, private]

The default path.

Default log file name.

Default pid file name.

The default port.

TclSpeedTestServer::host [static, private]

Advertised host name.

Error format string.

Http error messages.

TclSpeedTestServer::listen [static, private]

Listen socket.

TclSpeedTestServer::logchan [static, private]

Log channel.

Log file name.

Mime headers.

Pid file name.

TclSpeedTestServer::port [static, private]

The actual port (-port CLI option).

The protocol (GET or POST)

The query string.

TclSpeedTestServer::sockblock [static, private]

Socket blocking or not.

The current state.

TclSpeedTestServer::testbuffer [static, private]

Test buffer.

The local part of the URL.

TclSpeedTestServer::version [static, private]

The version string.