Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

GSocketImpl Class Reference

Implementation of a network socket. More...

#include <INet.h>

Inheritance diagram for GSocketImpl:

GSocket GStream GDom List of all members.

Public Member Functions

 GSocketImpl ()
 Creates the class.
 ~GSocketImpl ()
 Destroys the class.
OsSocket Handle (OsSocket Set=INVALID_SOCKET)
 Returns the operating system handle to the socket.
bool IsOK ()
 Returns true if the internal state of the class is ok.
void SetLogFile (char *FileName=0, int Type=NET_LOG_HEX_DUMP)
 Sets logging on the socket.
bool WhatsMyIp (char *IpAddr)
 Returns the IP address at this end of the socket.
int WhatsMyPort ()
 Returns the port at this end of the socket.
bool GetRemoteIp (char *IpAddr)
 Gets the IP address at the remote end of the socket.
bool IsReadable ()
 Returns whether there is data available for reading.
int Is (GSocketProp p)
 Allows you to query the socket for various things.
void Is (GSocketProp p, int i)
 Sets an option on the socket.
bool Cancel ()
 Returns true if the operation was cancelled.
void Cancel (bool i)
 Cancel the current operation.
int Open (char *HostAddr, int Port)
 Opens a connection.
bool IsOpen ()
 Returns true if the socket is connected.
int Close ()
 Closes the connection to the remote host.
bool Listen (int Port=0)
 Listens on a given port for an incomming connection.
bool Accept (GSocket *c)
 Accepts an incomming connection and connects the socket you pass in to the remote host.
int Write (void *Data, int Len, int Flags)
 Sends data to the remote host.
int Read (void *Data, int Len, int Flags)
 Reads data from the remote host.
int Error ()
 Returns the last error or 0.
int64 GetSize ()
 Not supported.
int64 SetSize (int64 Size)
 Not supported.
int64 GetPos ()
 Not supported.
int64 SetPos (int64 Pos)
 Not supported.
void OnDisconnect ()
 Gets called when the connection is disconnected.
void OnRead (char *Data, int Len)
 Gets called when data is received.
void OnWrite (char *Data, int Len)
 Gets called when data is sent.
void OnError (int ErrorCode, char *ErrorDescription)
 Gets called when an error occurs.
void OnInformation (char *Str)
 Gets called when some information is available.
int SetParameter (int Param, int Value)
 Parameter change handler.

Friends

class GNetwork

Detailed Description

Implementation of a network socket.


Member Function Documentation

bool GSocketImpl::Accept GSocket c  )  [virtual]
 

Accepts an incomming connection and connects the socket you pass in to the remote host.

Parameters:
c  The socket to handle the connection.

Implements GSocket.

int GSocketImpl::Open char *  HostAddr,
int  Port
[virtual]
 

Opens a connection.

Parameters:
HostAddr  The name of the remote host.
Port  The port on the remote host.

Reimplemented from GStream.

int GSocketImpl::Read void *  Data,
int  Len,
int  Flags
[virtual]
 

Reads data from the remote host.

Returns:
the number of bytes read or <= 0 on error.
Generally the number of bytes returned is less than the buffer size. Depending on how much data you are expecting you will need to keep reading until you get and end of field marker or the number of bytes your looking for.
Parameters:
Data  Pointer to the buffer to write output to
Len  The length of the receive buffer.
Flags  The flags to pass to recv

Reimplemented from GStream.

void GSocketImpl::SetLogFile char *  FileName = 0,
int  Type = NET_LOG_HEX_DUMP
[virtual]
 

Sets logging on the socket.

Parameters:
FileName  The file to log to
Type  The type of logging to do

Implements GSocket.

int GSocketImpl::SetParameter int  Param,
int  Value
[inline, virtual]
 

Parameter change handler.

Parameters:
Param  e.g. GSocket_Log

Implements GSocket.

int GSocketImpl::Write void *  Data,
int  Len,
int  Flags
[virtual]
 

Sends data to the remote host.

Returns:
the number of bytes written or <= 0 on error.
Parameters:
Data  Pointer to the data to write
Len  Numbers of bytes to write
Flags  Flags to pass to send

Reimplemented from GStream.


The documentation for this class was generated from the following files:
Generated on Wed Oct 26 14:47:02 2005 for Lgi by  doxygen 1.4.1