Go to the documentation of this file.
44 #ifndef CCXX_SOCKETPORT_H_
45 #define CCXX_SOCKETPORT_H_
47 #ifndef CCXX_ADDRESS_H_
51 #ifndef CCXX_SOCKET_H_
55 #ifdef CCXX_NAMESPACES
87 struct timeval porttimer;
96 bool detect_disconnect;
169 {
return detect_pending; }
181 {
return detect_output; }
231 inline ssize_t
send(
const void *buf,
size_t len)
232 {
return _IORET64 ::send(so, (
const char *)buf,
_IOLEN64 len, 0);};
243 {
return _IORET64 ::recv(so, (
char *)buf,
_IOLEN64 len, 0);};
253 inline ssize_t
peek(
void *buf,
size_t len)
254 {
return _IORET64 ::recv(so, (
char *)buf,
_IOLEN64 len, MSG_PEEK);};
386 #ifdef CCXX_NAMESPACES
unsigned short tpport_t
Transport Protocol Ports.
Definition: address.h:86
void setDetectPending(bool)
Used to indicate if the service thread should monitor pending data for us.
virtual ~SocketPort()
Disconnect the socket from the service thread pool and the remote connection.
void incTimer(timeout_t timeout)
Derived incTimer to notify the service thread pool of a change in expected timeout.
SocketService(int pri=0, size_t stack=0, const char *id=NULL)
Create a service thread for attaching socket ports.
ssize_t send(const void *buf, size_t len)
Transmit "send" data to a connected peer host.
Definition: socketport.h:231
void attach(SocketService *svc)
Attach yourself to the service pool thread object.
This object is used to hold the actual and valid internet address of a specific host machine that wil...
Definition: address.h:562
Every thread of execution in an application is created by instantiating an object of a class derived ...
Definition: thread.h:1094
TCP sockets are used for stream based connected sessions between two sockets.
Definition: socket.h:1396
virtual ~SocketService()
Terminate the thread pool and eliminate any attached socket ports.
unsigned long timeout_t
Definition: thread.h:74
ssize_t peek(void *buf, size_t len)
Examine the content of the next packet.
Definition: socketport.h:253
virtual void output(void)
Called by the service thread pool when output data is pending for this socket.
This object is used to hold the actual and valid internet address of a specific host machine that wil...
Definition: address.h:949
int HANDLE
Definition: serial.h:60
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
Definition: thread.h:187
SocketPort(SocketService *svc, const IPV4Host &ih, tpport_t port)
A non-blocking constructor for outbound tcp connections.
Error
Definition: socket.h:131
Network addresses and sockets related classes.
bool getDetectPending(void) const
Get the current state of the DetectPending flag.
Definition: socketport.h:168
virtual void onUpdate(unsigned char buf)
Handles all requests other than "termination".
ssize_t receive(void *buf, size_t len)
Receive a message from any host.
Definition: socketport.h:242
#define __EXPORT
Definition: config.h:979
The network name and address objects are all derived from a common IPV6Address base class.
Definition: address.h:754
The Socket is used as the base for all Internet protocol services under Common C++.
Definition: socket.h:120
The network name and address objects are all derived from a common IPV4Address base class.
Definition: address.h:351
virtual void onCallback(SocketPort *port)
Called for each port that is being processed in response to an event.
SocketPort(SocketService *svc, const IPV6Address &ia, tpport_t port)
SocketPort(SocketService *svc, const IPV6Host &ih, tpport_t port)
SocketPort(SocketService *svc, TCPV6Socket &tcp)
Error connect(const IPV4Address &ia, tpport_t port)
Connect a Socket Port to a known peer host.
virtual void expired(void)
Called by the service thread pool when the objects timer has expired.
virtual void pending(void)
Called by the service thread pool when input data is pending for this socket.
Error connect(const IPV6Address &ia, tpport_t port)
The socket port is an internal class which is attached to and then serviced by a specific SocketServi...
Definition: socketport.h:82
int getCount(void) const
Get current reference count.
Definition: socketport.h:382
SocketPort(SocketService *svc, TCPSocket &tcp)
Construct an accepted TCP socket connection from a specific bound TCP server.
TCPV6 sockets are used for stream based connected sessions between two ipv6 sockets.
Definition: socket.h:1515
void setTimer(timeout_t timeout=0)
Derived setTimer to notify the service thread pool of change in expected timeout.
bool getDetectOutput(void) const
Get the current state of the DetectOutput flag.
Definition: socketport.h:180
SocketPort(SocketService *svc, const IPV4Address &ia, tpport_t port)
Construct a bound UDP socket for use in deriving realtime UDP streaming protocols handled by thread p...
Network addresses and sockets related classes.
#define _IOLEN64
Definition: socket.h:64
void update(unsigned char flag=0xff)
Notify service thread that a port has been added or removed, or a timer changed, so that a new schedu...
The SocketService is a thread pool object that is meant to service attached socket ports.
Definition: socketport.h:289
virtual void disconnect(void)
Called by the service thread pool when a disconnect has occured.
virtual void onEvent(void)
Called once each time the service thread is rescheduled.
Timer ports are used to provide synchronized timing events when managed under a "service thread" such...
Definition: thread.h:1760
void setDetectOutput(bool)
Used to indicate if output ready monitoring should be performed by the service thread.