#include <INet.h>

Public Member Functions | |
| GSocket (GStreamI *logger=0) | |
| Creates the class. | |
| ~GSocket () | |
| 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. | |
| bool | GetLocalIp (char *IpAddr) |
| Returns the IP address at this end of the socket. | |
| int | GetLocalPort () |
| Returns the port at this end of the socket. | |
| bool | GetRemoteIp (char *IpAddr) |
| Gets the IP address at the remote end of the socket. | |
| int | GetRemotePort () |
| Gets the IP address at the remote end of the socket. | |
| int | GetTimeout () |
| Gets the current timeout for operations in ms. | |
| void | SetTimeout (int ms) |
| Sets the current timeout for operations in ms. | |
| bool | IsReadable (int TimeoutMs=0) |
| Returns whether there is data available for reading. | |
| bool | IsWritable (int TimeoutMs=0) |
| Returns whether there is data available for reading. | |
| bool | CanAccept (int TimeoutMs=0) |
| Returns if the socket is ready to accept a connection. | |
| bool | IsBlocking () |
| Returns if the socket is set to block. | |
| void | IsBlocking (bool block) |
| Set the socket to block. | |
| bool | IsDelayed () |
| Get the send delay setting. | |
| void | IsDelayed (bool Delay) |
| Set the send delay setting. | |
| 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 (GSocketI *c) |
| Accepts an incomming connection and connects the socket you pass in to the remote host. | |
| int | Write (void *Data, int Len, int Flags=0) |
| Sends data to the remote host. | |
| int | Read (void *Data, int Len, int Flags=0) |
| Reads data from the remote host. | |
| int | Error (void *Param=0) |
| 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. | |
| bool | GetUdp () |
| Get UPD mode. | |
| void | SetUdp (bool b) |
| Set UPD mode. | |
| int | ReadUdp (void *Buffer, int Size, int Flags, uint32 *Ip=0, uint16 *Port=0) |
| Read UPD packet. | |
| int | WriteUdp (void *Buffer, int Size, int Flags, uint32 Ip, uint16 Port) |
| Write UPD packet. | |
Friends | |
| class | GNetwork |
| bool GSocket::Accept | ( | GSocketI * | c | ) | [virtual] |
Accepts an incomming connection and connects the socket you pass in to the remote host.
| c | The socket to handle the connection. |
Reimplemented from GSocketI.
References GSocketI::Handle(), and IsReadable().
| int GSocket::Open | ( | char * | HostAddr, | |
| int | Port | |||
| ) | [virtual] |
Opens a connection.
| HostAddr | The name of the remote host. |
| Port | The port on the remote host. |
Reimplemented from GStream.
References Close(), Error(), IsBlocking(), IsWritable(), and OnInformation().
| int GSocket::Read | ( | void * | Data, | |
| int | Len, | |||
| int | Flags = 0 | |||
| ) | [virtual] |
Reads data from the remote host.
| 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.
References Error(), IsReadable(), OnDisconnect(), and OnRead().
| int GSocket::SetParameter | ( | int | Param, | |
| int | Value | |||
| ) | [inline] |
| int GSocket::Write | ( | void * | Data, | |
| int | Len, | |||
| int | Flags = 0 | |||
| ) | [virtual] |
Sends data to the remote host.
| Data | Pointer to the data to write |
| Len | Numbers of bytes to write |
| Flags | Flags to pass to send |
Reimplemented from GStream.
References Error(), IsWritable(), OnDisconnect(), and OnWrite().
1.5.7.1