Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

clSockOp Class Reference

Socket I/O operations. More...

#include <SockOp.hh>

List of all members.

Public Member Functions

 clSockOp ()
 clSockOp (int)
 ~clSockOp ()
void SetHandle (int)
 Set handle.

void Close ()
 Close handle/connection.

bool ReadSelect (int)
 Wait for socket to become readable.

bool WriteSelect (int)
 Wait for socket to become writable.

int Read (void *, int)
 Read data.

int Write (const void *, int)
 Write data.

int ReadN (void *, int)
 Read N bytes.

int WriteN (const void *, int)
 Write N bytes.

int Receive (void *, int, int)
 Receive data.

int Send (const void *, int, int)
 Send data.

int ReceiveMsg (struct msghdr *, int)
 Receive message.

int SendMsg (const struct msghdr *, int)
 Send message.

int Shutdown (int)
 Shutdown connection.

int GetSockName (struct sockaddr *, socklen_t *)
 Get address of this end.

int GetPeerName (struct sockaddr *, socklen_t *)
 Get address of remote end.

bool SetBlocking (bool)
 Set blocking/nonblocking IO.

bool SetKeepAlive ()
 Enable keepalive messages.

bool SetLinger (int)
 Enable linger option.

int GetRecvBufSize ()
 Get receive buffer size.

bool SetRecvBufSize (int)
 Set receive buffer size.

int GetSendBufSize ()
 Get send buffer size.

bool SetSendBufSize (int)
 Set send buffer size.

int GetRecvBufLowWater ()
 Get position of receive buffer low-water sign.

bool SetRecvBufLowWater (int)
 Set receive buffer low-water sign.

int GetSendBufLowWater ()
 Get position of send buffer low-water sign.

bool SetSendBufLowWater (int)
 Set send buffer low-water sign.

bool SetRecvTimeout (int)
 Set receive timeout.

bool SetSendTimeout (int)
 Set send timeout.

bool SetTCPKeepAlive (int)
 Set interval of TCP keepalive messages.

bool DisableNagle ()
 Disable TCP nagle-algorithm.

bool SetNagle (bool)
bool SetTypeOfService (int)
 Set type-of-service flag.

void SetCloseOnDestruct (bool)
 Close handle/connection in destructor.

int GetHandle ()
 Get handle (file descriptor).

int GetErrno ()
 Get errno.


Private Attributes

int iErrno
int iRetVal
int iSockH
bool bCloseOnDestruct


Detailed Description

Socket I/O operations.

Definition at line 39 of file SockOp.hh.


Constructor & Destructor Documentation

clSockOp::clSockOp  ) 
 

Definition at line 38 of file SockOp.cc.

References bCloseOnDestruct, and iSockH.

clSockOp::clSockOp int   ) 
 

Definition at line 45 of file SockOp.cc.

References bCloseOnDestruct, and iSockH.

clSockOp::~clSockOp  ) 
 

Definition at line 52 of file SockOp.cc.

References bCloseOnDestruct, and iSockH.


Member Function Documentation

void clSockOp::SetHandle int   ) 
 

Set handle.

Closes previously open handle.

Parameters:
iHandle Handle

Definition at line 58 of file SockOp.cc.

References Close(), and iSockH.

Referenced by clStreamDist::AudioInThread(), clBeamAudio::clBeamAudio(), clDirection2::clDirection2(), clDirection3::clDirection3(), clLevel::clLevel(), clLofarDemon::clLofarDemon(), clSpectrum::clSpectrum(), clSubLocate::ConnectDir(), clSpectrum::ConnectStream(), clSaveSrv::ConnectStream(), clLevel::ConnectStream(), clDirection3::ConnectStream(), clDirection2::ConnectStream(), clBeamAudio::ConnectStream(), clGUILocate::ConnectToServer(), clGUILevel::ConnectToServer(), clLofarDemon::GetDataHdr(), clGUILofar::InitConnection(), clBeamAudioUI::InitConnection(), main(), clBeamSrv2Master::Main(), clBeamSrvMaster::Main(), clSoundProxy::ServeClientThread(), clBeamSrv2Master::ServeClientThread(), clBeamSrvMaster::ServeClientThread(), clSoundUI::SoundInThread(), clSoundProxy::SoundInThread(), and clUIServer::Wait().

void clSockOp::Close  ) 
 

Close handle/connection.

Definition at line 65 of file SockOp.cc.

References iSockH.

Referenced by clGUILofar::OnConnectClick(), clGUILocate::OnConnectClick(), clGUILevel::OnConnectClick(), clBeamAudioUI::OnConnectClick(), clGUILofar::OnGdkInput(), clGUILocate::OnGdkInput(), clGUILevel::OnGdkInput(), clSoundProxy::ServeClientThread(), SetHandle(), clSoundUI::SoundInThread(), and clSoundProxy::SoundInThread().

bool clSockOp::ReadSelect int   ) 
 

Wait for socket to become readable.

Parameters:
iTimeoutMS Timeout (ms)
Returns:
Readable?

Definition at line 75 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by clSpectrum::ConnectStream(), clLevel::ConnectStream(), clDirection3::ConnectStream(), clDirection2::ConnectStream(), clBeamAudio::ConnectStream(), clSpectGUI::GdkInput(), clLofarDemon::GetDataHdr(), clDirection::GetFirstMsg(), clLevel::GetRequest(), clDirection::GetRequest(), clLofarDemon::GetRequestMsg(), clSpectrum::GetRq(), clDirection3::GetRq(), clDirection2::GetRq(), clBeamAudio::GetRq(), main(), clGUILofar::OnGdkInput(), clGUILocate::OnGdkInput(), clGUILevel::OnGdkInput(), clBeamAudioUI::OnGdkInput(), clBeamAudio::ProcessLoop(), clLevel::ReceiveData(), clDirection::ReceiveData(), clBeamAudioUI::SendSettings(), clSoundUI::SoundInThread(), and clSoundProxy::SoundInThread().

bool clSockOp::WriteSelect int   ) 
 

Wait for socket to become writable.

Parameters:
iTimeoutMS Timeout (ms)
Returns:
Writable?

Definition at line 100 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by clLofarDemon::SendResults(), clDirection::SendResults(), clSoundProxy::ServeClientThread(), and clBeamAudioUI::UpdateSettings().

int clSockOp::Read void *  ,
int 
 

Read data.

Parameters:
vpBuf Buffer
iBufLen Buffer size
Returns:
Bytes read

Definition at line 125 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

Referenced by main().

int clSockOp::Write const void *  ,
int 
 

Write data.

Parameters:
vpBuf Buffer
iBufLen Buffer size
Returns:
Bytes written

Definition at line 133 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

int clSockOp::ReadN void *  ,
int 
 

Read N bytes.

Ensures that N bytes are read, unless error occurs.

Parameters:
vpBuf Buffer
iBufLen Buffer size
Returns:
Bytes read

Definition at line 141 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

Referenced by clStreamDist::AudioInThread(), clSpectrum::ConnectStream(), clSaveSrv::ConnectStream(), clLevel::ConnectStream(), clDirection3::ConnectStream(), clDirection2::ConnectStream(), clBeamAudio::ConnectStream(), clGUILocate::ConnectToServer(), clSpectGUI::GdkInput(), clSpectrum::GetData(), clLofarDemon::GetDataHdr(), clDirection::GetFirstMsg(), clLevel::GetRequest(), clDirection::GetRequest(), clLofarDemon::GetRequestMsg(), clSpectrum::GetRq(), clDirection3::GetRq(), clDirection2::GetRq(), clBeamAudio::GetRq(), clBeamSrv2Master::InDataThread(), clBeamSrvMaster::InDataThread(), main(), clSubLocate::Main(), clBeamSrv2Master::Main(), clBeamSrvMaster::Main(), clLofarDemon::MainLoop(), clGUILofar::OnGdkInput(), clGUILocate::OnGdkInput(), clGUILevel::OnGdkInput(), clGUIDir::OnGdkInput(), clBeamAudioUI::OnGdkInput(), clSaveSrv::ProcessLoop(), clDirection3::ProcessLoop(), clDirection2::ProcessLoop(), clBeamAudio::ProcessLoop(), clLevel::ReceiveData(), clDirection::ReceiveData(), clBeamAudioUI::SendSettings(), clXMMSOut::ServeClientThread(), clStreamDist::ServeClientThread(), clSoundUI::SoundInThread(), and clSoundProxy::SoundInThread().

int clSockOp::WriteN const void *  ,
int 
 

Write N bytes.

Ensures that N bytes are written, unless error occurs.

Parameters:
vpBuf Buffer
iBufLen Buffer size
Returns:
Bytes written

Definition at line 160 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

Referenced by clSubLocate::ConnectDir(), clSpectrum::ConnectStream(), clSaveSrv::ConnectStream(), clLevel::ConnectStream(), clDirection3::ConnectStream(), clDirection2::ConnectStream(), clBeamAudio::ConnectStream(), clGUILevel::ConnectToServer(), clLofarDemon::GetDataHdr(), clDirection::GetFirstMsg(), clSpectGUI::InitConnection(), clGUILofar::InitConnection(), clGUIDir::InitConnection(), clBeamAudioUI::InitConnection(), main(), clBeamSrv2Master::Main(), clBeamSrvMaster::Main(), clSpectrum::ProcessLoop(), clDirection3::ProcessLoop(), clDirection2::ProcessLoop(), clBeamAudio::SendFirst(), clLevel::SendResult(), clBeamAudio::SendResult(), clLofarDemon::SendResults(), clDirection::SendResults(), clSpectGUI::SendSettings(), clGUILofar::SendSettings(), clGUILevel::SendSettings(), clGUIDir::SendSettings(), clBeamAudioUI::SendSettings(), clXMMSOut::ServeClientThread(), clStreamDist::ServeClientThread(), clSoundSrvA::ServeClientThread(), clSoundSrv2::ServeClientThread(), clSoundProxy::ServeClientThread(), clLocate::ServeClientThread(), clFileSrv::ServeClientThread(), clComediSrv::ServeClientThread(), clBeamSrv2Master::ServeClientThread(), clBeamSrvMaster::ServeClientThread(), and clBeamAudioUI::UpdateSettings().

int clSockOp::Receive void *  ,
int  ,
int 
 

Receive data.

Parameters:
vpBuf Buffer
iBufLen Buffer size
iFlags Flags
Returns:
Bytes received

Definition at line 180 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

int clSockOp::Send const void *  ,
int  ,
int 
 

Send data.

Parameters:
vpBuf Buffer
iBufLen Buffer size
iFlags Flags
Returns:
Bytes sent

Definition at line 188 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

int clSockOp::ReceiveMsg struct msghdr *  ,
int 
 

Receive message.

Parameters:
spMsgHdr Message header
iFlags Flags
Returns:
Bytes received

Definition at line 196 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

int clSockOp::SendMsg const struct msghdr *  ,
int 
 

Send message.

Parameters:
spMsgHdr Message header
iFlags Flags
Returns:
Bytes sent

Definition at line 204 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

int clSockOp::Shutdown int   ) 
 

Shutdown connection.

Parameters:
iShutdownDir Direction flag
Returns:
0 on success, -1 on error

Definition at line 212 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

Referenced by main(), clGUILofar::OnConnectClick(), clGUIDir::OnConnectClick(), clGUILofar::OnGdkInput(), clGUIDir::OnGdkInput(), and clSoundProxy::SoundInThread().

int clSockOp::GetSockName struct sockaddr *  ,
socklen_t * 
 

Get address of this end.

Parameters:
spAddr Address
ipAddrLen Address length
Returns:
0 on success, -1 on error

Definition at line 220 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

int clSockOp::GetPeerName struct sockaddr *  ,
socklen_t * 
 

Get address of remote end.

Parameters:
spAddr Address
ipAddrLen Address length
Returns:
0 on succes, -1 on error

Definition at line 228 of file SockOp.cc.

References iErrno, iRetVal, and iSockH.

Referenced by clSoundSrvA::ServeClientThread(), clSoundSrv2::ServeClientThread(), clSoundProxy::ServeClientThread(), clComediSrv::ServeClientThread(), and clUIServer::Wait().

bool clSockOp::SetBlocking bool   ) 
 

Set blocking/nonblocking IO.

Parameters:
bBlocking Blocking?
Returns:
Success

Definition at line 236 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetKeepAlive  ) 
 

Enable keepalive messages.

Returns:
Success

Definition at line 263 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetLinger int   ) 
 

Enable linger option.

Parameters:
iLingerTime Linger time
Returns:
Success

Definition at line 277 of file SockOp.cc.

References iErrno, and iSockH.

int clSockOp::GetRecvBufSize  ) 
 

Get receive buffer size.

Returns:
Size of receive buffer

Definition at line 293 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by clLofarDemon::MainLoop().

bool clSockOp::SetRecvBufSize int   ) 
 

Set receive buffer size.

Parameters:
iBufSize Size of receive buffer
Returns:
Success

Definition at line 309 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by clSubLocate::Main(), clLofarDemon::MainLoop(), clDirection3::ProcessLoop(), clDirection2::ProcessLoop(), and clSoundUI::SoundInThread().

int clSockOp::GetSendBufSize  ) 
 

Get send buffer size.

Returns:
Size of send buffer

Definition at line 321 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetSendBufSize int   ) 
 

Set send buffer size.

Parameters:
iBufSize Size of send buffer
Returns:
Success

Definition at line 337 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by clDirection3::ProcessLoop(), clDirection2::ProcessLoop(), clSoundSrvA::ServeClientThread(), clSoundSrv2::ServeClientThread(), and clComediSrv::ServeClientThread().

int clSockOp::GetRecvBufLowWater  ) 
 

Get position of receive buffer low-water sign.

Returns:
Low-water position

Definition at line 349 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetRecvBufLowWater int   ) 
 

Set receive buffer low-water sign.

Parameters:
iBufLowWater Position of receive low-water sign
Returns:
Success

Definition at line 365 of file SockOp.cc.

References iErrno, and iSockH.

int clSockOp::GetSendBufLowWater  ) 
 

Get position of send buffer low-water sign.

Returns:
Low-water position

Definition at line 377 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetSendBufLowWater int   ) 
 

Set send buffer low-water sign.

Parameters:
iBufLowWater Position of send low-water sign
Returns:
Success

Definition at line 393 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetRecvTimeout int   ) 
 

Set receive timeout.

Parameters:
iTimeoutMS Timeout (ms)
Returns:
Success

Definition at line 405 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetSendTimeout int   ) 
 

Set send timeout.

Parameters:
iTimeoutMS Timeout (ms)
Returns:
Success

Definition at line 421 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetTCPKeepAlive int   ) 
 

Set interval of TCP keepalive messages.

Parameters:
iTimeSec Time between keepalive messages (s)
Returns:
Success

Definition at line 437 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::DisableNagle  ) 
 

Disable TCP nagle-algorithm.

Returns:
Success

Definition at line 451 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by clBeamAudio::clBeamAudio(), main(), clSoundSrvA::ServeClientThread(), clSoundSrv2::ServeClientThread(), clSoundProxy::ServeClientThread(), clFileSrv::ServeClientThread(), clComediSrv::ServeClientThread(), clBeamSrv2Master::ServeClientThread(), clBeamSrvMaster::ServeClientThread(), and clSoundProxy::SoundInThread().

bool clSockOp::SetNagle bool   ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 465 of file SockOp.cc.

References iErrno, and iSockH.

bool clSockOp::SetTypeOfService int   ) 
 

Set type-of-service flag.

Parameters:
iTOS Type-of-service flag (IPTOS_*)
Returns:
Success

Definition at line 479 of file SockOp.cc.

References iErrno, and iSockH.

Referenced by main(), clSoundSrvA::ServeClientThread(), clSoundSrv2::ServeClientThread(), clSoundProxy::ServeClientThread(), clFileSrv::ServeClientThread(), clComediSrv::ServeClientThread(), clBeamSrv2Master::ServeClientThread(), clBeamSrvMaster::ServeClientThread(), and clSoundProxy::SoundInThread().

void clSockOp::SetCloseOnDestruct bool   ) 
 

Close handle/connection in destructor.

Parameters:
bSetting Close in destructor?

Definition at line 491 of file SockOp.cc.

References bCloseOnDestruct.

Referenced by clUIServer::Wait().

int clSockOp::GetHandle  )  [inline]
 

Get handle (file descriptor).

Returns:
Handle

Definition at line 287 of file SockOp.hh.

References iSockH.

Referenced by clGUILocate::OnConnectClick(), and clGUILevel::OnConnectClick().

int clSockOp::GetErrno  )  [inline]
 

Get errno.

Returns:
errno

Definition at line 293 of file SockOp.hh.

References iErrno.

Referenced by clStreamDist::AudioInThread(), clSaveSrv::ConnectStream(), clSpectGUI::GdkInput(), clDirection::GetFirstMsg(), clDirection::GetRequest(), clBeamSrv2Master::Main(), clBeamSrvMaster::Main(), clGUILofar::OnGdkInput(), clGUIDir::OnGdkInput(), clBeamAudioUI::OnGdkInput(), clSaveSrv::ProcessLoop(), clDirection::ReceiveData(), clLofarDemon::SendResults(), clDirection::SendResults(), clGUIDir::SendSettings(), clSoundProxy::ServeClientThread(), clBeamSrv2Master::ServeClientThread(), clBeamSrvMaster::ServeClientThread(), clSoundUI::SoundInThread(), clSoundProxy::SoundInThread(), and clBeamAudioUI::UpdateSettings().


Member Data Documentation

int clSockOp::iErrno [private]
 

Definition at line 41 of file SockOp.hh.

Referenced by DisableNagle(), GetErrno(), GetPeerName(), GetRecvBufLowWater(), GetRecvBufSize(), GetSendBufLowWater(), GetSendBufSize(), GetSockName(), Read(), ReadN(), ReadSelect(), Receive(), ReceiveMsg(), Send(), SendMsg(), SetBlocking(), SetKeepAlive(), SetLinger(), SetNagle(), SetRecvBufLowWater(), SetRecvBufSize(), SetRecvTimeout(), SetSendBufLowWater(), SetSendBufSize(), SetSendTimeout(), SetTCPKeepAlive(), SetTypeOfService(), Shutdown(), Write(), WriteN(), and WriteSelect().

int clSockOp::iRetVal [private]
 

Definition at line 42 of file SockOp.hh.

Referenced by GetPeerName(), GetSockName(), Read(), ReadN(), Receive(), ReceiveMsg(), Send(), SendMsg(), Shutdown(), Write(), and WriteN().

int clSockOp::iSockH [private]
 

Definition at line 43 of file SockOp.hh.

Referenced by Close(), clSockOp(), DisableNagle(), GetHandle(), GetPeerName(), GetRecvBufLowWater(), GetRecvBufSize(), GetSendBufLowWater(), GetSendBufSize(), GetSockName(), Read(), ReadN(), ReadSelect(), Receive(), ReceiveMsg(), Send(), SendMsg(), SetBlocking(), SetHandle(), SetKeepAlive(), SetLinger(), SetNagle(), SetRecvBufLowWater(), SetRecvBufSize(), SetRecvTimeout(), SetSendBufLowWater(), SetSendBufSize(), SetSendTimeout(), SetTCPKeepAlive(), SetTypeOfService(), Shutdown(), Write(), WriteN(), WriteSelect(), and ~clSockOp().

bool clSockOp::bCloseOnDestruct [private]
 

Definition at line 44 of file SockOp.hh.

Referenced by clSockOp(), SetCloseOnDestruct(), and ~clSockOp().


The documentation for this class was generated from the following files:
Generated on Sun Oct 26 19:12:23 2003 for HASAS by doxygen 1.3.3