#include <Socket.h>
Inheritance diagram for Socket:

Public Member Functions | |
| Socket () | |
| Create a new "empty" unconnected socket. | |
| Socket (int fd) | |
| Create a socket connected to fd. | |
| int | getError () |
| Get errors, not all functions (constructors, etc) can return errors. | |
| int | close () |
| Close this socket. | |
| ssize_t | read (void *buf, size_t nbytes) const |
| Blocking read() on this socket. | |
| ssize_t | write (const void *buf, size_t nbytes) const |
| write() on this socket. | |
Protected Attributes | |
| bool | connected |
| Is this socket connected? | |
| int | sockID |
| The "fd" this socket is connected to (for use with read() and write()). | |
| int | error |
| Error value indicating what went wrong, usually errno is copied here. | |
| Socket::Socket | ( | ) | [inline] |
Create a new "empty" unconnected socket.
| Socket::Socket | ( | int | fd | ) | [inline] |
Create a socket connected to fd.
WARNING This constructor does NOT connect to fd, it assumes it is already a valid socket id. This constructor should probably NOT be used!
| fd | An already connected socket identifier |
| int Socket::close | ( | ) | [inline] |
Close this socket.
| int Socket::getError | ( | ) | [inline] |
Get errors, not all functions (constructors, etc) can return errors.
In order not to depend on exceptions this function can be called after calls to certain memberfunctions to see if an error occured.
| ssize_t Socket::read | ( | void * | buf, | |
| size_t | nbytes | |||
| ) | const [inline] |
Blocking read() on this socket.
Note that this function does NOT take notice of byte-order, so if you are reading anything other than strings you should take care of converting it to the correct byte-order after reading it.
| buf | data buffer to used store result, of size nbytes or more | |
| nbytes | The numer of bytes to read. |
| ssize_t Socket::write | ( | const void * | buf, | |
| size_t | nbytes | |||
| ) | const [inline] |
write() on this socket.
Note that this function does NOT take notice of byte-order, so if you are writing anything other than strings you should take care of converting it to the correct byte-order before writing it.
| buf | data buffer to write FROM, of size nbytes or more | |
| nbytes | The numer of bytes to write from buf. |
bool Socket::connected [protected] |
Is this socket connected?
int Socket::error [protected] |
Error value indicating what went wrong, usually errno is copied here.
int Socket::sockID [protected] |
1.4.7