Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

TcpClient.h
1#ifndef STK_TCPCLIENT_H
2#define STK_TCPCLIENT_H
3
4#include "Socket.h"
5
6 namespace stk {
7
8/***************************************************/
31/***************************************************/
32
33 class TcpClient : public Socket
34{
35 public:
37
40 TcpClient( int port, std::string hostname = "localhost" );
41
43 ~TcpClient();
44
46
51 int connect( int port, std::string hostname = "localhost" );
52
54 int writeBuffer(const void *buffer, long bufferSize, int flags = 0);
55
57 int readBuffer(void *buffer, long bufferSize, int flags = 0);
58
59 protected:
60
61};
62
63} // stk namespace
64
65#endif
stk::Socket
STK internet socket abstract base class.
Definition Socket.h:39
stk::Socket::port
int port(void) const
Return the socket port number.
Definition Socket.h:60
stk::TcpClient
STK TCP socket client class.
Definition TcpClient.h:34
stk::TcpClient::TcpClient
TcpClient(int port, std::string hostname="localhost")
Default class constructor creates a socket client connection to the specified host and port.
stk::TcpClient::connect
int connect(int port, std::string hostname="localhost")
Connect the socket client to the specified host and port and returns the resulting socket descriptor.
stk::TcpClient::~TcpClient
~TcpClient()
The class destructor closes the socket instance, breaking any existing connections.
stk::TcpClient::readBuffer
int readBuffer(void *buffer, long bufferSize, int flags=0)
Read a buffer from the socket connection, up to length bufferSize. Returns the number of bytes read o...
stk::TcpClient::writeBuffer
int writeBuffer(const void *buffer, long bufferSize, int flags=0)
Write a buffer over the socket connection. Returns the number of bytes written or -1 if an error occu...
stk
The STK namespace.
Definition ADSR.h:6

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