TMCSocket Class Reference
[MCCore]

List of all members.

Public Types

enum  EProtocol { kTCP, kUDP, kInvalidProtocol }

Public Member Functions

 TMCSocket ()
 ~TMCSocket ()
void Init (EProtocol protocol, int32 portNumber)
void SendBroadcast (uint32 broadcastAddress, const TMCString &message)
void BindToPort ()
boolean WaitForReadableData (float timeOutInSeconds)
void ListenForConnections ()
bool Accept (TMCSocket &outSocket, float timeOutInSeconds)
bool Connect (const char *serverAddress, float timeOut)
int32 GetData (char *buffer, int32 bufferSize)
int32 PutData (const char *buffer, int32 bytesCount)
boolean IsClosed ()
void Close ()

Static Public Member Functions

void Initialize ()
void GetHostIPAddress (uint32 &ipAddress, uint32 subNetID, uint32 subNetMask)
void IPtoString (uint32 address, TMCString &string)
void StringtoIP (const TMCString &string, uint32 &address)
void GetDefaultSubNet (uint32 &subNetID, uint32 &subNetMask)
void GetHostName (TMCString &name)
int32 CheckForRead (const TMCPtrArray< TMCSocket > &socketArray, real timeOutInSeconds)

Protected Attributes

int32 fPortNumber
uint32 fSocketID
EProtocol fProtocol

Static Protected Attributes

boolean sInitialized

Detailed Description

TMCSocket is a simple abstraction of the bsd sockets


Member Enumeration Documentation

enum TMCSocket::EProtocol
 

Enumeration values:
kTCP 
kUDP 
kInvalidProtocol 


Constructor & Destructor Documentation

TMCSocket::TMCSocket (   ) 
 

TMCSocket::~TMCSocket (   ) 
 


Member Function Documentation

bool TMCSocket::Accept (  TMCSocket &  outSocket,
float  timeOutInSeconds
) 
 

void TMCSocket::BindToPort (   ) 
 

binds the socket to its port

int32 TMCSocket::CheckForRead (  const TMCPtrArray< TMCSocket > &  socketArray,
real  timeOutInSeconds
)  [static]
 

void TMCSocket::Close (   ) 
 

bool TMCSocket::Connect (  const char *  serverAddress,
float  timeOut
) 
 

int32 TMCSocket::GetData (  char *  buffer,
int32  bufferSize
) 
 

returns the number of characters read

void TMCSocket::GetDefaultSubNet (  uint32 &  subNetID,
uint32 &  subNetMask
)  [static]
 

Returns the default the subnet info (the first adapter found on the system)

Parameters:
subNetID The ID of the sub Net
subNetMask The mask of the sub Net

void TMCSocket::GetHostIPAddress (  uint32 &  ipAddress,
uint32  subNetID,
uint32  subNetMask
)  [static]
 

Returns the IP address of the local machine on a given sub net. If no address matches the given subnet then the first ip address is returned.

Parameters:
ipAddress The IP Address
subNetID The ID of the sub Net
subNetMask The mask of the sub Net

void TMCSocket::GetHostName (  TMCString &  name  )  [static]
 

Returns a string that contains the name of the local machine

Parameters:
name The name of the local machine

void TMCSocket::Init (  EProtocol  protocol,
int32  portNumber
) 
 

void TMCSocket::Initialize (   )  [static]
 

should be called once before using any of the socket code

void TMCSocket::IPtoString (  uint32  address,
TMCString &  string
)  [static]
 

Returns the string that corresponds to an IP address.

Parameters:
address The IP address
string The string

boolean TMCSocket::IsClosed (   ) 
 

void TMCSocket::ListenForConnections (   ) 
 

int32 TMCSocket::PutData (  const char *  buffer,
int32  bytesCount
) 
 

void TMCSocket::SendBroadcast (  uint32  broadcastAddress,
const TMCString &  message
) 
 

broadcast udp message

void TMCSocket::StringtoIP (  const TMCString &  string,
uint32 &  address
)  [static]
 

Returns the IP address corresponding to a string

Parameters:
address The IP address
string The string

boolean TMCSocket::WaitForReadableData (  float  timeOutInSeconds  ) 
 

wait for data to be available for reading, return false if times out


Member Data Documentation

int32 TMCSocket::fPortNumber [protected]
 

EProtocol TMCSocket::fProtocol [protected]
 

uint32 TMCSocket::fSocketID [protected]
 

boolean TMCSocket::sInitialized [static, protected]
 


The documentation for this class was generated from the following file:
Generated on Mon Mar 14 12:29:09 2005 for Carrara SDK Doc by  doxygen 1.3.9.1