Rudiments
|
Inherits serversocket, and inetsocketutil.
Public Member Functions | |
inetserversocket () | |
inetserversocket (const inetserversocket &i) | |
inetserversocket & | operator= (const inetserversocket &i) |
virtual | ~inetserversocket () |
bool | listen (const char *address, uint16_t port, int32_t backlog) |
bool | initialize (const char *address, uint16_t port) |
bool | bind () |
bool | listen (int32_t backlog) |
filedescriptor * | accept () |
uint16_t | getPort () |
![]() | |
serversocket () | |
serversocket (const serversocket &s) | |
serversocket & | operator= (const serversocket &s) |
virtual | ~serversocket () |
virtual bool | supportsBlockingNonBlockingModes () |
virtual bool | useNonBlockingMode () const |
virtual bool | useBlockingMode () const |
bool | lingerOnClose (int32_t timeout) |
bool | dontLingerOnClose () |
bool | reuseAddresses () |
bool | dontReuseAddresses () |
![]() | |
server () | |
server (const server &s) | |
server & | operator= (const server &s) |
virtual | ~server () |
![]() | |
filedescriptor () | |
filedescriptor (const filedescriptor &f) | |
filedescriptor & | operator= (const filedescriptor &f) |
virtual | ~filedescriptor () |
virtual bool | close () |
int32_t | getFileDescriptor () const |
void | setFileDescriptor (int32_t filedesc) |
int32_t | duplicate () const |
bool | duplicate (int32_t newfd) const |
bool | isUsingNonBlockingMode () const |
ssize_t | write (uint16_t number) const |
ssize_t | write (uint32_t number) const |
ssize_t | write (uint64_t number) const |
ssize_t | write (int16_t number) const |
ssize_t | write (int32_t number) const |
ssize_t | write (int64_t number) const |
ssize_t | write (float number) const |
ssize_t | write (double number) const |
ssize_t | write (unsigned char character) const |
ssize_t | write (char character) const |
ssize_t | write (bool value) const |
ssize_t | write (const unsigned char *string) const |
ssize_t | write (const char *string) const |
ssize_t | write (const unsigned char *string, size_t size) const |
ssize_t | write (const char *string, size_t size) const |
ssize_t | write (const void *buffer, size_t size) const |
ssize_t | write (uint16_t number, long sec, long usec) const |
ssize_t | write (uint32_t number, long sec, long usec) const |
ssize_t | write (uint64_t number, long sec, long usec) const |
ssize_t | write (int16_t number, long sec, long usec) const |
ssize_t | write (int32_t number, long sec, long usec) const |
ssize_t | write (int64_t number, long sec, long usec) const |
ssize_t | write (float number, long sec, long usec) const |
ssize_t | write (double number, long sec, long usec) const |
ssize_t | write (unsigned char character, long sec, long usec) const |
ssize_t | write (char character, long sec, long usec) const |
ssize_t | write (bool value, long sec, long usec) const |
ssize_t | write (const unsigned char *string, long sec, long usec) const |
ssize_t | write (const char *string, long sec, long usec) const |
ssize_t | write (const unsigned char *string, size_t size, long sec, long usec) const |
ssize_t | write (const char *string, size_t size, long sec, long usec) const |
ssize_t | write (const void *buffer, size_t size, long sec, long usec) const |
ssize_t | read (uint16_t *buffer) const |
ssize_t | read (uint32_t *buffer) const |
ssize_t | read (uint64_t *buffer) const |
ssize_t | read (int16_t *buffer) const |
ssize_t | read (int32_t *buffer) const |
ssize_t | read (int64_t *buffer) const |
ssize_t | read (float *buffer) const |
ssize_t | read (double *buffer) const |
ssize_t | read (unsigned char *buffer) const |
ssize_t | read (char *buffer) const |
ssize_t | read (bool *buffer) const |
ssize_t | read (unsigned char *buffer, size_t size) const |
ssize_t | read (char *buffer, size_t size) const |
ssize_t | read (void *buf, size_t size) const |
ssize_t | read (char **buffer, const char *terminator) const |
ssize_t | read (uint16_t *buffer, long sec, long usec) const |
ssize_t | read (uint32_t *buffer, long sec, long usec) const |
ssize_t | read (uint64_t *buffer, long sec, long usec) const |
ssize_t | read (int16_t *buffer, long sec, long usec) const |
ssize_t | read (int32_t *buffer, long sec, long usec) const |
ssize_t | read (int64_t *buffer, long sec, long usec) const |
ssize_t | read (float *buffer, long sec, long usec) const |
ssize_t | read (double *buffer, long sec, long usec) const |
ssize_t | read (unsigned char *buffer, long sec, long usec) const |
ssize_t | read (char *buffer, long sec, long usec) const |
ssize_t | read (bool *buffer, long sec, long usec) const |
ssize_t | read (unsigned char *buffer, size_t size, long sec, long usec) const |
ssize_t | read (char *buffer, size_t size, long sec, long usec) const |
ssize_t | read (void *buf, size_t size, long sec, long usec) const |
ssize_t | read (char **buffer, const char *terminator, long sec, long usec) const |
int32_t | waitForNonBlockingRead (long sec, long usec) const |
int32_t | waitForNonBlockingWrite (long sec, long usec) const |
void | retryInterruptedReads () |
void | dontRetryInterruptedReads () |
void | retryInterruptedWrites () |
void | dontRetryInterruptedWrites () |
void | retryInterruptedWaits () |
void | dontRetryInterruptedWaits () |
void | retryInterruptedFcntl () |
void | dontRetryInterruptedFcntl () |
void | retryInterruptedIoctl () |
void | dontRetryInterruptedIoctl () |
void | allowShortReads () |
void | dontAllowShortReads () |
void | allowShortWrites () |
void | dontAllowShortWrites () |
void | useListener (listener *lstnr) |
void | dontUseListener () |
listener * | getListener () |
void | useListenerInsideReads () |
void | dontUseListenerInsideReads () |
void | useListenerInsideWrites () |
void | dontUseListenerInsideWrites () |
virtual bool | passFileDescriptor (int32_t fd) const |
virtual bool | receiveFileDescriptor (int32_t *fd) const |
void | translateByteOrder () |
void | dontTranslateByteOrder () |
int32_t | fCntl (int32_t command, long arg) const |
int32_t | ioCtl (int32_t command, void *arg) const |
bool | useNaglesAlgorithm () |
bool | dontUseNaglesAlgorithm () |
bool | setTcpWriteBufferSize (int32_t size) |
bool | getTcpWriteBufferSize (int32_t *size) |
bool | setTcpReadBufferSize (int32_t size) |
bool | getTcpReadBufferSize (int32_t *size) |
const char * | getType () const |
char * | getPeerAddress () const |
bool | setWriteBufferSize (ssize_t size) const |
bool | flushWriteBuffer (long sec, long usec) const |
bool | setReadBufferSize (ssize_t size) const |
bool | closeOnExec () |
bool | dontCloseOnExec () |
bool | getCloseOnExec () |
Additional Inherited Members | |
![]() | |
inetsocketutil () | |
inetsocketutil (const inetsocketutil &i) | |
inetsocketutil & | operator= (const inetsocketutil &i) |
virtual | ~inetsocketutil () |
The inetserversocket class allows you to write programs that can talk to other programs across a network over TCP stream sockets.
The inetserversocket class provides methods for setting up sockets and accepting client connections. Its ultimate parent class, filedescriptor, provides methods for reading and writing data and closing connections.
If you need to listen on more than one socket at a time or a combination of sockets and other file descriptors, then you should use the inetserversocket class in conjunction with the listener class.
inetserversocket::inetserversocket | ( | ) |
Creates an instance of the inetserversocket class.
inetserversocket::inetserversocket | ( | const inetserversocket & | i | ) |
Creates an instance of the inetserversocket class that is a copy of "i".
|
virtual |
Deletes this instance of the inetserversocket class.
|
virtual |
Removes the client connection from the queue and associates a new socket with that connection. Communication with the client may be done over this new socket.
Returns an inetsocket on success and NULL on failure.
Implements server.
|
virtual |
Associates the socket with an address.
Returns true on success and false on failure.
Implements server.
uint16_t inetserversocket::getPort | ( | ) |
Returns the inet port number that the socket is listening on. If the port has not been set, 0 is returned instead. Writes the address of the client at the other end of "sock" to "buffer".
bool inetserversocket::initialize | ( | const char * | address, |
uint16_t | port | ||
) |
Creates the actual socket and initializes the class to use "address" and "port" when bind() is called.
Returns true on success and false on failure.
Reimplemented from inetsocketutil.
bool inetserversocket::listen | ( | const char * | address, |
uint16_t | port, | ||
int32_t | backlog | ||
) |
Convenience method that calls initialize(), bind() and listen(). If you need to set socket options or do anything else special between those discrete steps then you should use the methods individually.
Listens on "address" and "port" and allow "backlog" connections to pile up before refusing them.
To listen on all addresses enter a NULL for "address". Entering a value of 0 for the "port" causes the server to listen on an arbitrary port.
The getPort() method can be used later to discover this port.
Returns true on success and false on failure.
|
virtual |
Waits until a client connects then places that connection in queue. Up to "backlog" connections may be queued before future conenctions are refused.
Returns true on success and false on failure.
Reimplemented from serversocket.
inetserversocket& inetserversocket::operator= | ( | const inetserversocket & | i | ) |
Makes this instance of the inetserversocket class identical to "i".