# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLNET::CTcpSock Class Reference

CTcpSock: Reliable socket via TCP. More...

#include <tcp_sock.h>

Inheritance diagram for NLNET::CTcpSock:

NLNET::CSock NLNET::CDummyTcpSock NLNET::CListenSock List of all members.

Public Methods

Socket setup
 CTcpSock (bool logging=true)
 Constructor. More...

 CTcpSock (SOCKET sock, const CInetAddress &remoteaddr)
 Construct a CTcpSock object using an already connected socket descriptor and its associated remote address. More...

virtual void connect (const CInetAddress &addr)
 Connection. More...

void connectWithCustomWindowSize (const CInetAddress &addr, int windowsize)
 Sets a custom TCP Window size (SO_RCVBUF and SO_SNDBUF). More...

uint32 getWindowSize ()
 Returns the TCP Window Size for the current socket. More...

virtual void setNoDelay (bool value)
 Sets/unsets TCP_NODELAY (by default, it is off, i.e. More...

void shutdownReceiving ()
 Active disconnection for download way only (partial shutdown). More...

void shutdownSending ()
 Active disconnection for upload way only (partial shutdown). More...

virtual void disconnect ()
 Active disconnection (shutdown) (mutexed). connected() becomes false. More...


Detailed Description

CTcpSock: Reliable socket via TCP.

See base class CSock.

When to set No Delay mode on ? Set TCP_NODELAY (call setNoDelay(true)) *only* if you have to send small buffers that need to be sent *immediately*. It should only be set for applications that send frequent small bursts of information without getting an immediate response, where timely delivery of data is required (the canonical example is mouse movements). Setting TCP_NODELAY on increases the network traffic (more overhead). In the normal behavior of CSock, TCP_NODELAY is off i.e. the Nagle buffering algorithm is enabled.

Author:
Olivier Cado , Nevrax France
Date:
2000-2001

Definition at line 51 of file tcp_sock.h.


Constructor & Destructor Documentation

NLNET::CTcpSock::CTcpSock bool    logging = true
 

Constructor.

Parameters:
logging  Disable logging if the server socket object is used by the logging system, to avoid infinite recursion

Definition at line 61 of file tcp_sock.cpp.

Referenced by NLNET::CListenSock::accept, and NLNET::CDummyTcpSock::CDummyTcpSock.

NLNET::CTcpSock::CTcpSock SOCKET    sock,
const CInetAddress   remoteaddr
 

Construct a CTcpSock object using an already connected socket descriptor and its associated remote address.

Definition at line 69 of file tcp_sock.cpp.


Member Function Documentation

void NLNET::CTcpSock::connect const CInetAddress   addr [virtual]
 

Connection.

You can reconnect a socket after being disconnected. This method does not return a boolean, otherwise a programmer could ignore the result and no exception would be thrown if connection fails :

Reimplemented from NLNET::CSock.

Reimplemented in NLNET::CDummyTcpSock.

Definition at line 80 of file tcp_sock.cpp.

References NLNET::CSock::_Sock, addr, NLNET::CSock::close, and NLNET::CSock::createSocket.

void NLNET::CTcpSock::connectWithCustomWindowSize const CInetAddress   addr,
int    windowsize
 

Sets a custom TCP Window size (SO_RCVBUF and SO_SNDBUF).

You must close the socket is necessary, before calling this method.

See http://www.ncsa.uiuc.edu/People/vwelch/net_perf/tcp_windows.html

Definition at line 161 of file tcp_sock.cpp.

References NLNET::CSock::_Sock, addr, NLNET::CSock::createSocket, and nlerror.

void NLNET::CTcpSock::disconnect   [virtual]
 

Active disconnection (shutdown) (mutexed). connected() becomes false.

Reimplemented in NLNET::CDummyTcpSock.

Definition at line 101 of file tcp_sock.cpp.

References NLNET::CSock::_Connected, NLNET::CSock::_RemoteAddr, NLNET::CSock::_Sock, and nldebug.

uint32 NLNET::CTcpSock::getWindowSize  
 

Returns the TCP Window Size for the current socket.

Definition at line 185 of file tcp_sock.cpp.

References NLNET::CSock::_Sock.

void NLNET::CTcpSock::setNoDelay bool    value [virtual]
 

Sets/unsets TCP_NODELAY (by default, it is off, i.e.

the Nagle buffering algorithm is enabled). You must call this method *after* connect().

Reimplemented in NLNET::CDummyTcpSock.

Definition at line 146 of file tcp_sock.cpp.

References NLNET::CSock::_Sock, and value.

void NLNET::CTcpSock::shutdownReceiving  
 

Active disconnection for download way only (partial shutdown).

Definition at line 120 of file tcp_sock.cpp.

References NLNET::CSock::_Sock.

void NLNET::CTcpSock::shutdownSending  
 

Active disconnection for upload way only (partial shutdown).

Definition at line 133 of file tcp_sock.cpp.

References NLNET::CSock::_Sock.


The documentation for this class was generated from the following files: