#include <sstuff.hh>
Public Member Functions | |
Socket (AddressFamily af, SocketType st, ProtocolType pt=0) | |
Construct a socket of specified AddressFamily and SocketType. | |
Socket * | accept () |
If the socket is capable of doing so, this function will wait for a connection. | |
void | setNonBlocking () |
Set the socket to non-blocking. | |
void | bind (const IPEndpoint &ep) |
Bind the socket to a specified endpoint. | |
void | recvFrom (string &dgram, IPEndpoint &ep) |
For datagram sockets, receive a datagram and learn where it came from. | |
void | sendTo (const string &dgram, const IPEndpoint &ep) |
For datagram sockets, send a datagram to a destination. | |
void | writen (const string &data) |
Write this data to the socket, taking care that all bytes are written out. | |
unsigned int | tryWrite (const char *ptr, int toWrite) |
tries to write toWrite bytes from ptr to the socket | |
unsigned int | write (const char *ptr, int toWrite) |
Writes toWrite bytes from ptr to the socket. | |
int | getchar () |
reads one character from the socket | |
void | read (string &data) |
Reads a block of data from the socket to a string. | |
int | read (char *buffer, int bytes) |
Reads a block of data from the socket to a block of memory. | |
void | listen (unsigned int length=10) |
Sets the socket to listen with a default listen backlog of 10 bytes. | |
int | getHandle () const |
Returns the internal file descriptor of the socket. |
|
For datagram sockets, receive a datagram and learn where it came from
Definition at line 144 of file sstuff.hh. References IPEndpoint::address, IPAddress::byte, and IPEndpoint::port. Referenced by UDPListener::recvFrom(). |
|
For datagram sockets, send a datagram to a destination
Definition at line 161 of file sstuff.hh. References IPEndpoint::address, IPAddress::byte, and IPEndpoint::port. Referenced by UDPListener::sendTo(). |
|
tries to write toWrite bytes from ptr to the socket, but does not make sure they al get written out
|
|
Writes toWrite bytes from ptr to the socket. Returns how many bytes were written |