WXP C++ Library Version 6.74.9
|
This class manages socket based network connections. More...
#include "../include/Socket.h"
Public Types | |
enum | Type { UNK , DGRAM , DGRAM_SERVER , DGRAM_CLIENT , STREAM , STREAM_SERVER , STREAM_CLIENT } |
Public Member Functions | |
Socket () | |
~Socket () | |
int | init () |
bool | isOpen () |
int | open (const char *address, int type) |
int | close () |
int | reconnect () |
int | read (unsigned char *buf, int size) |
int | readLine (unsigned char *buf, int size) |
int | write (const unsigned char *buf, int size) |
This class manages socket based network connections.
Socket::Socket | ( | ) |
Constructor - initializes data
References init().
Socket::~Socket | ( | ) |
Destructor - cleans up socket connection
References close().
int Socket::close | ( | ) |
int Socket::init | ( | ) |
Initializes data
Referenced by Socket().
int Socket::open | ( | const char * | address, |
int | rtype | ||
) |
Opens the socket
address | The host:port |
rtype | Type of socket (DGRAM_SERVER, DGRAM_CLIENT, STREAM_SERVER, STREAM_CLIENT) |
References WXP::Wxp::outWarning(), and WXP::Wxp::sleep().
int Socket::read | ( | unsigned char * | buf, |
int | size | ||
) |
Reads data from socket
buf | The buffer to write data to |
size | The size of the buffer |
Referenced by readLine().
int Socket::readLine | ( | unsigned char * | buf, |
int | bsize | ||
) |
Reads a line (terminated with
) of data from socket
buf | The buffer to write data to |
bsize | The size of the buffer |
References read().