#include <ezSockets.h>
Collaboration diagram for ezSockets:
Public Types | |
enum | SockState { skDISCONNECTED = 0, skUNDEF1, skLISTENING, skUNDEF3, skUNDEF4, skUNDEF5, skUNDEF6, skCONNECTED, skERROR } |
enum | TransportMode { skPackets = 0, skGeneral, skUDP } |
Public Member Functions | |
ezSockets () | |
~ezSockets () | |
bool | Create (int Protocol=IPPROTO_TCP, int Type=SOCK_STREAM) |
bool | Bind (unsigned short port) |
bool | Listen (unsigned long depth=5) |
bool | Accept (ezSockets &socket) |
ezSockets * | Accept () |
bool | Connect (const MString &host, unsigned short port) |
void | Close () |
bool | Check () |
bool | CanRead () |
bool | DataAvailable () |
bool | IsError () |
bool | CanWrite () |
void | SendData (const MString &outData) |
void | SendData (const char *data, unsigned int bytes) |
int | ReadData (char *data, unsigned int bytes) |
int | PeekData (char *data, unsigned int bytes) |
bool | ReadLine (MString &str) |
void | WriteLine (const MString &str) |
int | ReadLeftover (char *data, unsigned int maxbytes) |
void | SendPack (const ezSocketsPacket &pPack) |
int | ReadPack (ezSocketsPacket &pPack) |
int | PeekPack (ezSocketsPacket &pPack) |
MString | GetAddress () |
bool | SetupForReuseAddr (bool bAllow) |
bool | SetupForMulticast (const MString &sAddressToJoin) |
bool | SetupForBroadcast (bool bBroadcast) |
Public Attributes | |
bool | bBlocking |
enum ezSockets::SockState | state |
int | lastCode |
enum ezSockets::TransportMode | mode |
Private Member Functions | |
void | ReceiveGeneralData (bool bForceBlock=false) |
int | pReadData (char *data, int maxsize) |
int | pWriteData (const char *data, int dataSize) |
Private Attributes | |
MString | address |
ezSocketsPacket * | pDataInHead |
ezSocketsPacket * | pDataInTail |
int | iBytesInPending |
int | iReadInPending |
sockaddr_in | fromAddr |
int | maxcon |
int | sock |
sockaddr_in | addr |
fd_set * | scks |
timeval * | times |
char | Buffer [ezSocketsBuffersize] |
Definition at line 64 of file ezSockets.h.
enum ezSockets::SockState |
skDISCONNECTED | |
skUNDEF1 | |
skLISTENING | |
skUNDEF3 | |
skUNDEF4 | |
skUNDEF5 | |
skUNDEF6 | |
skCONNECTED | |
skERROR |
Definition at line 117 of file ezSockets.h.
ezSockets::ezSockets | ( | ) |
Definition at line 199 of file ezSockets.cpp.
ezSockets::~ezSockets | ( | ) |
Definition at line 220 of file ezSockets.cpp.
bool ezSockets::Create | ( | int | Protocol = IPPROTO_TCP , |
|
int | Type = SOCK_STREAM | |||
) |
Definition at line 236 of file ezSockets.cpp.
bool ezSockets::Bind | ( | unsigned short | port | ) |
Definition at line 248 of file ezSockets.cpp.
bool ezSockets::Listen | ( | unsigned long | depth = 5 |
) |
Definition at line 260 of file ezSockets.cpp.
bool ezSockets::Accept | ( | ezSockets & | socket | ) |
Definition at line 270 of file ezSockets.cpp.
ezSockets * ezSockets::Accept | ( | ) |
Definition at line 297 of file ezSockets.cpp.
bool ezSockets::Connect | ( | const MString & | host, | |
unsigned short | port | |||
) |
Definition at line 351 of file ezSockets.cpp.
void ezSockets::Close | ( | ) |
Definition at line 333 of file ezSockets.cpp.
bool ezSockets::Check | ( | ) |
Definition at line 227 of file ezSockets.cpp.
bool ezSockets::CanRead | ( | ) |
Definition at line 392 of file ezSockets.cpp.
bool ezSockets::DataAvailable | ( | ) |
Definition at line 400 of file ezSockets.cpp.
bool ezSockets::IsError | ( | ) |
Definition at line 412 of file ezSockets.cpp.
bool ezSockets::CanWrite | ( | ) |
Definition at line 427 of file ezSockets.cpp.
void ezSockets::SendData | ( | const MString & | outData | ) |
Definition at line 436 of file ezSockets.cpp.
void ezSockets::SendData | ( | const char * | data, | |
unsigned int | bytes | |||
) |
Definition at line 442 of file ezSockets.cpp.
int ezSockets::ReadData | ( | char * | data, | |
unsigned int | bytes | |||
) |
Definition at line 448 of file ezSockets.cpp.
int ezSockets::PeekData | ( | char * | data, | |
unsigned int | bytes | |||
) |
Definition at line 463 of file ezSockets.cpp.
bool ezSockets::ReadLine | ( | MString & | str | ) |
Definition at line 487 of file ezSockets.cpp.
void ezSockets::WriteLine | ( | const MString & | str | ) |
Definition at line 554 of file ezSockets.cpp.
int ezSockets::ReadLeftover | ( | char * | data, | |
unsigned int | maxbytes | |||
) |
Definition at line 560 of file ezSockets.cpp.
void ezSockets::SendPack | ( | const ezSocketsPacket & | pPack | ) |
Definition at line 734 of file ezSockets.cpp.
int ezSockets::ReadPack | ( | ezSocketsPacket & | pPack | ) |
Definition at line 758 of file ezSockets.cpp.
int ezSockets::PeekPack | ( | ezSocketsPacket & | pPack | ) |
Definition at line 817 of file ezSockets.cpp.
MString ezSockets::GetAddress | ( | ) | [inline] |
Definition at line 139 of file ezSockets.h.
bool ezSockets::SetupForReuseAddr | ( | bool | bAllow | ) |
Definition at line 833 of file ezSockets.cpp.
bool ezSockets::SetupForMulticast | ( | const MString & | sAddressToJoin | ) |
Definition at line 844 of file ezSockets.cpp.
bool ezSockets::SetupForBroadcast | ( | bool | bBroadcast | ) |
Definition at line 856 of file ezSockets.cpp.
void ezSockets::ReceiveGeneralData | ( | bool | bForceBlock = false |
) | [private] |
Definition at line 615 of file ezSockets.cpp.
int ezSockets::pReadData | ( | char * | data, | |
int | maxsize | |||
) | [private] |
Definition at line 866 of file ezSockets.cpp.
int ezSockets::pWriteData | ( | const char * | data, | |
int | dataSize | |||
) | [private] |
Definition at line 877 of file ezSockets.cpp.
bool ezSockets::bBlocking |
Definition at line 115 of file ezSockets.h.
Definition at line 130 of file ezSockets.h.
MString ezSockets::address [private] |
Definition at line 145 of file ezSockets.h.
ezSocketsPacket* ezSockets::pDataInHead [private] |
Definition at line 146 of file ezSockets.h.
ezSocketsPacket* ezSockets::pDataInTail [private] |
Definition at line 147 of file ezSockets.h.
int ezSockets::iBytesInPending [private] |
Definition at line 148 of file ezSockets.h.
int ezSockets::iReadInPending [private] |
Definition at line 149 of file ezSockets.h.
struct sockaddr_in ezSockets::fromAddr [read, private] |
Definition at line 155 of file ezSockets.h.
int ezSockets::maxcon [private] |
Definition at line 157 of file ezSockets.h.
int ezSockets::sock [private] |
Definition at line 158 of file ezSockets.h.
struct sockaddr_in ezSockets::addr [read, private] |
Definition at line 159 of file ezSockets.h.
fd_set* ezSockets::scks [private] |
Definition at line 162 of file ezSockets.h.
timeval* ezSockets::times [private] |
Definition at line 163 of file ezSockets.h.
char ezSockets::Buffer[ezSocketsBuffersize] [private] |
Definition at line 172 of file ezSockets.h.