17#ifndef _DECAF_NET_SOCKET_H_
18#define _DECAF_NET_SOCKET_H_
55 mutable volatile bool created;
67 Socket(
const Socket& );
68 Socket& operator= (
const Socket& );
147 Socket(
const std::string& host,
int port );
187 virtual void bind(
const std::string& ipaddress,
int port );
208 virtual void connect(
const std::string& host,
int port);
227 virtual void connect(
const std::string& host,
int port,
int timeout);
256 return inputShutdown;
263 return outputShutdown;
Interface for a class that implements the close method.
Definition Closeable.h:30
Base interface for any class that wants to represent an output stream of bytes.
Definition OutputStream.h:39
Represents an IP address.
Definition InetAddress.h:33
This class implements server sockets.
Definition ServerSocket.h:50
bool isOutputShutdown() const
Definition Socket.h:262
friend class ServerSocket
Definition Socket.h:63
Socket(const std::string &host, int port, const InetAddress *localAddress, int localPort)
Creates a new Socket instance and connects it to the given host and port.
void ensureCreated() const
virtual void setSendBufferSize(int size)
Gets the send buffer size for this socket, SO_SNDBUF, this value is used by the platform socket to bu...
SocketImpl * impl
Definition Socket.h:48
int getLocalPort() const
Gets the local port the socket is bound to.
Socket(SocketImpl *impl)
Creates a Socket wrapping the provided SocketImpl instance, this Socket is considered unconnected.
bool isInputShutdown() const
Definition Socket.h:255
virtual int getSoTimeout() const
Gets the timeout for socket operations, SO_TIMEOUT.
virtual int getReceiveBufferSize() const
Gets the receive buffer size for this socket, SO_RCVBUF.
bool isConnected() const
Indicates whether or not this socket is connected to am end point.
Definition Socket.h:234
virtual void connect(const std::string &host, int port)
Connects to the specified destination.
Socket(const std::string &host, int port)
Creates a new Socket instance and connects it to the given host and port.
virtual void connect(const std::string &host, int port, int timeout)
Connects to the specified destination, with a specified timeout value.
virtual void setReceiveBufferSize(int size)
Sets the receive buffer size for this socket, SO_RCVBUF.
static void setSocketImplFactory(SocketImplFactory *factory)
Sets the instance of a SocketImplFactory that the Socket class should use when new instances of this ...
virtual bool getKeepAlive() const
Gets the keep alive flag for this socket, SO_KEEPALIVE.
virtual decaf::io::OutputStream * getOutputStream()
Gets the OutputStream for this socket if it is connected.
virtual void bind(const std::string &ipaddress, int port)
Binds this Socket to the given local address and port.
void initSocketImpl(const std::string &address, int port, const InetAddress *localAddress, int localPort)
Socket()
Creates an unconnected Socket using the set SocketImplFactory or if non is set than the default SockI...
virtual bool getTcpNoDelay() const
Gets the Status of the TCP_NODELAY setting for this socket.
virtual void setReuseAddress(bool reuse)
Sets the reuse address flag, SO_REUSEADDR.
int getPort() const
Gets the on the remote host this Socket is connected to.
virtual decaf::io::InputStream * getInputStream()
Gets the InputStream for this socket if its connected.
virtual bool getOOBInline() const
Gets the value of the OOBINLINE for this socket.
bool isBound() const
Definition Socket.h:248
virtual int getSoLinger() const
Gets the linger time for the socket, SO_LINGER.
virtual void setTcpNoDelay(bool value)
Sets the Status of the TCP_NODELAY param for this socket., this setting is used to disable or enable ...
virtual int getTrafficClass() const
Gets the Traffic Class setting for this Socket, sometimes referred to as Type of Service setting.
virtual int getSendBufferSize() const
Gets the send buffer size for this socket, SO_SNDBUF, this value is used by the platform socket to bu...
virtual void close()
Closes the Socket.
virtual std::string toString() const
virtual void shutdownOutput()
Shuts down the OutputStream for this socket, any data already written to the socket will be sent,...
virtual void setKeepAlive(bool keepAlive)
Enables/disables the keep alive flag for this socket, SO_KEEPALIVE.
Socket(const InetAddress *address, int port)
Creates a new Socket instance and connects it to the given address and port.
virtual void setSoTimeout(int timeout)
Sets the timeout for socket operations, SO_TIMEOUT.
std::string getInetAddress() const
Returns the address to which the socket is connected.
virtual void sendUrgentData(int data)
Sends on byte of urgent data to the Socket.
Socket(const InetAddress *address, int port, const InetAddress *localAddress, int localPort)
Creates a new Socket instance and connects it to the given address and port.
virtual void setSoLinger(bool state, int timeout)
Sets the linger time (SO_LINGER) using a specified time value, this limits of this value are platform...
virtual void setOOBInline(bool value)
Sets the value of the OOBINLINE for this socket, by default this option is disabled.
std::string getLocalAddress() const
Gets the local address to which the socket is bound.
virtual void setTrafficClass(int value)
Gets the Traffic Class setting for this Socket, sometimes referred to as Type of Service setting.
virtual bool getReuseAddress() const
Gets the reuse address flag, SO_REUSEADDR.
virtual void shutdownInput()
Shuts down the InputStream for this socket essentially marking it as EOF.
bool isClosed() const
Definition Socket.h:241
Factory class interface for a Factory that creates ScoketImpl objects.
Definition SocketImplFactory.h:38
Acts as a base class for all physical Socket implementations.
Definition SocketImpl.h:42
#define DECAF_API
Definition Config.h:29
Definition URLStreamHandlerManager.h:26
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25