Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

MMSockCommunic Class Reference

Multi-machine socket communicator Handles the communication between a client and the master, from the client's point of view. More...

Inheritance diagram for MMSockCommunic:
CallBacker

List of all members.

Public Types

enum  State {
  Undef, Working, WrapUp, Finished,
  AllDone, Paused, JobError, HostError,
  Killed, Timeout
}

Public Member Functions

 MMSockCommunic (const char *host, int port, int jobid, StreamData &)
bool ok ()
const char * errMsg ()
State state () const
void setState (State s)
bool updateState ()
bool updateProgress (int p)
bool sendState (bool isexit=false)
bool sendProgress (int p)
bool sendErrMsg (const char *msg)
 hostrelated error messages are more serious.
bool sendPID (int pid)
bool pauseRequested () const

Protected Member Functions

SocketmkSocket ()
bool sendState_ (State, bool isexit, bool immediate)
bool sendProgress_ (int, bool immediate)
bool sendPID_ (int)
bool sendErrMsg_ (const char *msg)
void alarmHndl (CallBacker *)
 time-out

Protected Attributes

BufferString masterhost_
int masterport_
bool stillok_
State stat_
BufferString errmsg_
int jobid_
bool pausereq_
StreamDatasdout_

Private Member Functions

bool updateMsg (char tag, int, const char *msg=0)
bool sendMsg (char tag, int, const char *msg=0)
void directMsg (const char *msg)
 directly to bp.stdout.ostrem or std::cerr.
void setErrMsg (const char *m)
void checkMasterTimeout ()

Private Attributes

int timestamp_
int nrattempts_
int maxtries_
int socktimeout_
int failtimeout_
int min_time_between_update_
int lastsucces_

Detailed Description

Multi-machine socket communicator Handles the communication between a client and the master, from the client's point of view.


Member Enumeration Documentation

Enumerator:
Undef 
Working 
WrapUp 
Finished 
AllDone 
Paused 
JobError 
HostError 
Killed 
Timeout 

Constructor & Destructor Documentation

MMSockCommunic::MMSockCommunic ( const char *  host,
int  port,
int  jobid,
StreamData  
)

Member Function Documentation

void MMSockCommunic::alarmHndl ( CallBacker  )  [protected]

time-out

void MMSockCommunic::checkMasterTimeout (  )  [private]
void MMSockCommunic::directMsg ( const char *  msg  )  [private]

directly to bp.stdout.ostrem or std::cerr.

const char* MMSockCommunic::errMsg (  )  [inline]
Socket* MMSockCommunic::mkSocket (  )  [protected]
bool MMSockCommunic::ok (  )  [inline]
bool MMSockCommunic::pauseRequested (  )  const [inline]
bool MMSockCommunic::sendErrMsg ( const char *  msg  )  [inline]

hostrelated error messages are more serious.

bool MMSockCommunic::sendErrMsg_ ( const char *  msg  )  [protected]
bool MMSockCommunic::sendMsg ( char  tag,
int  ,
const char *  msg = 0 
) [private]
bool MMSockCommunic::sendPID ( int  pid  )  [inline]
bool MMSockCommunic::sendPID_ ( int   )  [protected]
bool MMSockCommunic::sendProgress ( int  p  )  [inline]
bool MMSockCommunic::sendProgress_ ( int  ,
bool  immediate 
) [protected]
bool MMSockCommunic::sendState ( bool  isexit = false  )  [inline]
bool MMSockCommunic::sendState_ ( State  ,
bool  isexit,
bool  immediate 
) [protected]
void MMSockCommunic::setErrMsg ( const char *  m  )  [inline, private]
void MMSockCommunic::setState ( State  s  )  [inline]
State MMSockCommunic::state (  )  const [inline]
bool MMSockCommunic::updateMsg ( char  tag,
int  ,
const char *  msg = 0 
) [private]
bool MMSockCommunic::updateProgress ( int  p  )  [inline]
bool MMSockCommunic::updateState (  )  [inline]

Member Data Documentation

int MMSockCommunic::jobid_ [protected]
int MMSockCommunic::masterport_ [protected]
bool MMSockCommunic::pausereq_ [protected]
bool MMSockCommunic::stillok_ [protected]