Library: Net
Package: WebSocket
Header: Poco/Net/WebSocketImpl.h
Description
Inheritance
Direct Base Classes: StreamSocketImpl
All Base Classes: SocketImpl, StreamSocketImpl, Poco::RefCountedObject
Member Summary
Member Functions: acceptConnection, available, bind, bind6, close, connect, connectNB, frameFlags, getBlocking, getMaxPayloadSize, getReceiveBufferSize, getReceiveTimeout, getSendBufferSize, getSendTimeout, incompleteHeader, listen, mustMaskPayload, peekHeader, peekSomeBytes, receiveBytes, receiveFrom, receiveNBytes, receivePayload, receiveSomeBytes, secure, sendBytes, sendTo, sendUrgent, setBlocking, setMaxPayloadSize, setReceiveBufferSize, setReceiveTimeout, setSendBufferSize, setSendTimeout, shutdown, shutdownReceive, shutdownSend, skipHeader
Inherited Functions: acceptConnection, address, available, bind, bind6, checkBrokenTimeout, close, connect, connectNB, duplicate, error, fcntl, getBlocking, getBroadcast, getError, getKeepAlive, getLinger, getNoDelay, getOOBInline, getOption, getRawOption, getReceiveBufferSize, getReceiveTimeout, getReuseAddress, getReusePort, getSendBufferSize, getSendTimeout, init, initSocket, initialized, ioctl, lastError, listen, peerAddress, poll, receiveBytes, receiveFrom, referenceCount, release, reset, secure, sendBytes, sendFile, sendFileBlockwise, sendFileNative, sendTo, sendUrgent, setBlocking, setBroadcast, setKeepAlive, setLinger, setNoDelay, setOOBInline, setOption, setRawOption, setReceiveBufferSize, setReceiveTimeout, setReuseAddress, setReusePort, setSendBufferSize, setSendTimeout, shutdown, shutdownReceive, shutdownSend, socketError, sockfd, type, useFileDescriptor
Nested Classes
struct ReceiveState
struct SendState
Enumerations
Anonymous
FRAME_FLAG_MASK = 0x80
MAX_HEADER_LENGTH = 14
MASK_LENGTH = 4
Constructors
WebSocketImpl
WebSocketImpl(
StreamSocketImpl * pStreamSocketImpl,
HTTPSession & session,
bool mustMaskPayload
);
Creates a WebSocketImpl.
Destructor
~WebSocketImpl
virtual ~WebSocketImpl();
Member Functions
acceptConnection
virtual SocketImpl * acceptConnection(
SocketAddress & clientAddr
);
available
virtual int available();
See also: Poco::Net::SocketImpl::available()
bind
virtual void bind(
const SocketAddress & address,
bool reuseAddress = false
);
See also: Poco::Net::SocketImpl::bind()
bind
virtual void bind(
const SocketAddress & address,
bool reuseAddress,
bool reusePort
);
See also: Poco::Net::SocketImpl::bind()
bind6
virtual void bind6(
const SocketAddress & address,
bool reuseAddress = false,
bool ipV6Only = false
);
See also: Poco::Net::SocketImpl::bind6()
bind6
virtual void bind6(
const SocketAddress & address,
bool reuseAddress,
bool reusePort,
bool ipV6Only
);
See also: Poco::Net::SocketImpl::bind6()
close
virtual void close();
See also: Poco::Net::SocketImpl::close()
connect
virtual void connect(
const SocketAddress & address
);
See also: Poco::Net::SocketImpl::connect()
connect
virtual void connect(
const SocketAddress & address,
const Poco::Timespan & timeout
);
See also: Poco::Net::SocketImpl::connect()
connectNB
virtual void connectNB(
const SocketAddress & address
);
See also: Poco::Net::SocketImpl::connectNB()
frameFlags
int frameFlags() const;
Returns the frame flags of the most recently received frame.
getBlocking
virtual bool getBlocking() const;
See also: Poco::Net::SocketImpl::getBlocking()
getMaxPayloadSize
int getMaxPayloadSize() const;
Returns the maximum payload size for receiveFrame().
The default is std::numeric_limits<int>::max().
getReceiveBufferSize
virtual int getReceiveBufferSize();
getReceiveTimeout
virtual Poco::Timespan getReceiveTimeout();
getSendBufferSize
virtual int getSendBufferSize();
getSendTimeout
virtual Poco::Timespan getSendTimeout();
See also: Poco::Net::SocketImpl::getSendTimeout()
listen
virtual void listen(
int backlog = 64
);
See also: Poco::Net::SocketImpl::listen()
mustMaskPayload
bool mustMaskPayload() const;
Returns true if the payload must be masked.
receiveBytes
virtual int receiveBytes(
void * buffer,
int length,
int flags
);
Receives a WebSocket protocol frame.
See WebSocket::receiveFrame() for more information, including behavior if set to non-blocking.
See also: Poco::Net::SocketImpl::receiveBytes()
receiveBytes
virtual int receiveBytes(
Poco::Buffer < char > & buffer,
int flags = 0,
const Poco::Timespan & span = 0
);
Receives a WebSocket protocol frame.
See WebSocket::receiveFrame() for more information, including behavior if set to non-blocking.
See also: Poco::Net::SocketImpl::receiveBytes()
receiveFrom
virtual int receiveFrom(
void * buffer,
int length,
SocketAddress & address,
int flags = 0
);
See also: Poco::Net::SocketImpl::receiveFrom()
secure
virtual bool secure() const;
See also: Poco::Net::SocketImpl::secure()
sendBytes
virtual int sendBytes(
const void * buffer,
int length,
int flags
);
Sends a WebSocket protocol frame.
See WebSocket::sendFrame() for more information, including behavior if set to non-blocking.
See also: Poco::Net::StreamSocketImpl::sendBytes()
sendTo
virtual int sendTo(
const void * buffer,
int length,
const SocketAddress & address,
int flags = 0
);
See also: Poco::Net::SocketImpl::sendTo()
sendUrgent
virtual void sendUrgent(
unsigned char data
);
See also: Poco::Net::SocketImpl::sendUrgent()
setBlocking
virtual void setBlocking(
bool flag
);
See also: Poco::Net::SocketImpl::setBlocking()
setMaxPayloadSize
void setMaxPayloadSize(
int maxPayloadSize
);
Sets the maximum payload size for receiveFrame().
The default is std::numeric_limits<int>::max().
setReceiveBufferSize
virtual void setReceiveBufferSize(
int size
);
setReceiveTimeout
virtual void setReceiveTimeout(
const Poco::Timespan & timeout
);
setSendBufferSize
virtual void setSendBufferSize(
int size
);
setSendTimeout
virtual void setSendTimeout(
const Poco::Timespan & timeout
);
See also: Poco::Net::SocketImpl::setSendTimeout()
shutdown
virtual int shutdown();
See also: Poco::Net::SocketImpl::shutdown()
shutdownReceive
virtual void shutdownReceive();
See also: Poco::Net::SocketImpl::shutdownReceive()
shutdownSend
virtual int shutdownSend();
See also: Poco::Net::SocketImpl::shutdownSend()
incompleteHeader
int incompleteHeader(
ReceiveState & receiveState
);
Called by peekHeader() when the bytes available do not make a complete frame header. Returns 0 if the peer has closed the connection, so that the caller reports the close, and -1 otherwise, so that the caller waits for the rest of the header.
Clears the frame flags, which the caller may already have taken from the part of the header it did receive.
peekHeader
int peekHeader(
ReceiveState & receiveState
);
peekSomeBytes
int peekSomeBytes(
char * buffer,
int length
);
receiveNBytes
int receiveNBytes(
void * buffer,
int length
);
receivePayload
int receivePayload(
char * buffer,
int payloadLength,
char mask[MASK_LENGTH],
bool useMask,
int maskOffset
);
receiveSomeBytes
int receiveSomeBytes(
char * buffer,
int length
);
skipHeader
void skipHeader(
int headerLength
);