Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# stk::Socket Class Reference

STK internet socket abstract base class. More...

`#include <Socket.h>`

Inheritance diagram for stk::Socket:

List of all members.

## Public Member Functions
| Socket ()
| Class constructor.
virtual | ~Socket ()
| Class destructor.
int | id (void) const
| Return the socket descriptor.
int | port (void) const
| Return the socket port number.
virtual int | writeBuffer (const void *buffer, long bufferSize, int flags=0)=0
| Write a buffer over the socket connection. Returns the number of bytes written or -1 if an error occurs.
virtual int | readBuffer (void *buffer, long bufferSize, int flags=0)=0
| Read an input buffer, up to length bufferSize. Returns the number of bytes read or -1 if an error occurs.
## Static Public Member Functions
static void | close (int socket)
| Close the socket.
static bool | isValid (int socket)
| Returns true if the socket descriptor is valid.
static void | setBlocking (int socket, bool enable)
| If enable = false, the socket is set to non-blocking mode. When first created, sockets are by default in blocking mode.
static int | writeBuffer (int socket, const void *buffer, long bufferSize, int flags)
| Write a buffer via the specified socket. Returns the number of bytes written or -1 if an error occurs.
static int | readBuffer (int socket, void *buffer, long bufferSize, int flags)
| Read a buffer via the specified socket. Returns the number of bytes read or -1 if an error occurs.

## Detailed Description

STK internet socket abstract base class.

This class provides common functionality for TCP and UDP internet socket server and client subclasses. This class also provides a number of static functions for use with external socket descriptors.

by Perry R. Cook and Gary P. Scavone, 1995 - 2010.

The documentation for this class was generated from the following file:

- Socket.h

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.