TMCSocket Class Reference
[MCCore]
List of all members.
Classes |
struct | IPAddress |
Public Member Functions |
virtual MCErr MCCOMAPI | QueryInterface (const MCIID &riid, void **ppvObj) |
virtual uint32 MCCOMAPI | AddRef () |
virtual uint32 MCCOMAPI | Release () |
virtual void MCCOMAPI | Init (EProtocol protocol, int32 portNumber) |
virtual void MCCOMAPI | SendBroadcast (uint32 broadcastAddress, const TMCString &message) |
virtual void MCCOMAPI | BindToPort () |
virtual boolean MCCOMAPI | WaitForReadableData (float timeOutInSeconds) |
virtual void MCCOMAPI | ListenForConnections () |
virtual bool MCCOMAPI | Accept (IMCSocket *outSocket, float timeOutInSeconds) |
virtual bool MCCOMAPI | Connect (const char *serverAddress, float timeOut) |
virtual int32 MCCOMAPI | GetData (char *buffer, int32 bufferSize) |
virtual int32 MCCOMAPI | PutData (const char *buffer, int32 bytesCount) |
virtual boolean MCCOMAPI | IsClosed () |
virtual void MCCOMAPI | Close () |
Static Public Member Functions |
static void | Initialize () |
static void | GetHostIPAddress (uint32 &ipAddress, uint32 subNetID, uint32 subNetMask) |
static void | IPtoString (uint32 address, TMCString &string) |
static void | StringtoIP (const TMCString &string, uint32 &address) |
static void | GetDefaultSubNet (uint32 &subNetID, uint32 &subNetMask) |
static void | GetHostName (TMCString &name) |
static int32 | CheckForRead (const TMCCountedPtrArray< IMCSocket > &socketArray, real timeOutInSeconds) |
static void | Create (IMCSocket **socket) |
Protected Member Functions |
| TMCSocket () |
| ~TMCSocket () |
Protected Attributes |
int32 | fPortNumber |
uintpointer | fSocketID |
EProtocol | fProtocol |
Static Protected Attributes |
static boolean | sInitialized |
Detailed Description
TMCSocket is a simple abstraction of the bsd sockets
Constructor & Destructor Documentation
TMCSocket::TMCSocket |
( |
|
) |
[protected] |
TMCSocket::~TMCSocket |
( |
|
) |
[protected] |
Member Function Documentation
virtual bool MCCOMAPI TMCSocket::Accept |
( |
IMCSocket * |
outSocket, |
|
|
float |
timeOutInSeconds | |
|
) |
| | [virtual] |
Waits for a connection on a socket. Returns a new socket if a connection is established
- Parameters:
-
| outSocket | |
| timeOutInSeconds | |
Implements IMCSocket.
virtual uint32 MCCOMAPI TMCSocket::AddRef |
( |
|
) |
[inline, virtual] |
virtual void MCCOMAPI TMCSocket::BindToPort |
( |
|
) |
[virtual] |
binds the socket to its port
Implements IMCSocket.
virtual void MCCOMAPI TMCSocket::Close |
( |
|
) |
[virtual] |
virtual bool MCCOMAPI TMCSocket::Connect |
( |
const char * |
serverAddress, |
|
|
float |
timeOut | |
|
) |
| | [virtual] |
static void TMCSocket::Create |
( |
IMCSocket ** |
socket |
) |
[static] |
virtual int32 MCCOMAPI TMCSocket::GetData |
( |
char * |
buffer, |
|
|
int32 |
bufferSize | |
|
) |
| | [virtual] |
returns the number of characters read
Implements IMCSocket.
static 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 |
static 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 |
static 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 |
virtual void MCCOMAPI TMCSocket::Init |
( |
EProtocol |
protocol, |
|
|
int32 |
portNumber | |
|
) |
| | [virtual] |
Initializes the socket.
- Parameters:
-
| protocol | The protocol to use for the socket |
| portNumber | The port number to which the socket should be attached |
Implements IMCSocket.
static void TMCSocket::Initialize |
( |
|
) |
[static] |
should be called once before using any of the socket code
static 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 |
virtual boolean MCCOMAPI TMCSocket::IsClosed |
( |
|
) |
[virtual] |
virtual void MCCOMAPI TMCSocket::ListenForConnections |
( |
|
) |
[virtual] |
virtual int32 MCCOMAPI TMCSocket::PutData |
( |
const char * |
buffer, |
|
|
int32 |
bytesCount | |
|
) |
| | [virtual] |
virtual MCErr MCCOMAPI TMCSocket::QueryInterface |
( |
const MCIID & |
riid, |
|
|
void ** |
ppvObj | |
|
) |
| | [inline, virtual] |
Check if the object supports a given interface and returns a pointer to that interface if it does. Note that QueryInterface will increment the reference count of the object by one if the interface is found.
- Parameters:
-
| riid | GUID of the interface |
| ppvObj | A pointer to the pointer being returned. |
Reimplemented from TMCSMPCountedObject.
virtual uint32 MCCOMAPI TMCSocket::Release |
( |
|
) |
[inline, virtual] |
Decrements the reference count of the object. If the reference count reaches zero, the object is destroyed.
Reimplemented from TMCSMPCountedObject.
virtual void MCCOMAPI TMCSocket::SendBroadcast |
( |
uint32 |
broadcastAddress, |
|
|
const TMCString & |
message | |
|
) |
| | [virtual] |
static 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 |
virtual boolean MCCOMAPI TMCSocket::WaitForReadableData |
( |
float |
timeOutInSeconds |
) |
[virtual] |
wait for data to be available for reading, return false if times out
Implements IMCSocket.
Member Data Documentation
The documentation for this class was generated from the following file: