|
| | TcpSocket () |
| | Construct a non-connected socket.
|
| |
| virtual | ~TcpSocket () |
| | Releases the socket handle but not gracefully shut down the connection.
|
| |
| bool | isConnected () const |
| |
| bool | isClosed () const |
| |
| virtual std::string | getLocalAddress () const |
| | Gets the value of the local Inet address the Socket is bound to if bound, otherwise return the InetAddress ANY value "0.0.0.0".- Returns
- the local address bound to, or ANY.
|
| |
| virtual void | create () |
| | Creates the underlying platform Socket data structures which allows for Socket options to be applied.The created socket is in an unconnected state.- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual void | accept (SocketImpl *socket) |
| |
| virtual void | bind (const std::string &ipaddress, int port) |
| | Binds this Socket instance to the local ip address and port number given.- Parameters
-
| ipaddress | The address of local ip to bind to. |
| port | The port number on the host to bind to. |
- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual void | connect (const std::string &hostname, int port, int timeout) |
| | Connects this socket to the given host and port.- Parameters
-
| hostname | The name of the host to connect to, or IP address. |
| port | The port number on the host to connect to. |
| timeout | Time in milliseconds to wait for a connection, 0 indicates forever. |
- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
| SocketTimeoutException | if the connect call times out due to timeout being set. |
| IllegalArguementException | if a parameter has an illegal value. |
|
| |
| virtual void | listen (int backlog) |
| | Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.If a connection indication arrives when the queue is full, the connection is refused.- Parameters
-
| backlog | The maximum length of the connection queue. |
- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual decaf::io::InputStream * | getInputStream () |
| | Gets the InputStream linked to this Socket.- Returns
- an InputStream pointer owned by the Socket object.
- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual decaf::io::OutputStream * | getOutputStream () |
| | Gets the OutputStream linked to this Socket.- Returns
- an OutputStream pointer owned by the Socket object.
- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual int | available () |
| | Gets the number of bytes that can be read from the Socket without blocking.- Returns
- the number of bytes that can be read from the Socket without blocking.
- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual void | close () |
| | Closes the socket, terminating any blocked reads or writes.- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual void | shutdownInput () |
| | Places the input stream for this socket at "end of stream".Any data sent to this socket is acknowledged and then silently discarded. If you read from a socket input stream after invoking shutdownInput() on the socket, the stream will return EOF.- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual void | shutdownOutput () |
| | Disables the output stream for this socket.For a TCP socket, any previously written data will be sent followed by TCP's normal connection termination sequence. If you write to a socket output stream after invoking shutdownOutput() on the socket, the stream will throw an IOException.- Exceptions
-
| IOException | if an I/O error occurs while attempting this operation. |
|
| |
| virtual int | getOption (int option) const |
| | Gets the specified Socket option.- Parameters
-
| option | The Socket options whose value is to be retrieved. |
- Returns
- the value of the given socket option.
- Exceptions
-
| IOException | if an I/O error occurs while performing this operation. |
|
| |
| virtual void | setOption (int option, int value) |
| | Sets the specified option on the Socket if supported.- Parameters
-
| option | The Socket option to set. |
| value | The value of the socket option to apply to the socket. |
- Exceptions
-
| IOException | if an I/O error occurs while performing this operation. |
|
| |
| int | read (unsigned char *buffer, int size, int offset, int length) |
| | Reads the requested data from the Socket and write it into the passed in buffer.
|
| |
| void | write (const unsigned char *buffer, int size, int offset, int length) |
| | Writes the specified data in the passed in buffer to the Socket.
|
| |
| | SocketImpl () |
| |
| virtual | ~SocketImpl () |
| |
| virtual void | create ()=0 |
| | Creates the underlying platform Socket data structures which allows for Socket options to be applied.
|
| |
| virtual void | accept (SocketImpl *socket)=0 |
| | Accepts a new connection on the given Socket.
|
| |
| virtual void | connect (const std::string &hostname, int port, int timeout)=0 |
| | Connects this socket to the given host and port.
|
| |
| virtual void | bind (const std::string &ipaddress, int port)=0 |
| | Binds this Socket instance to the local ip address and port number given.
|
| |
| virtual void | listen (int backlog)=0 |
| | Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
|
| |
| virtual decaf::io::InputStream * | getInputStream ()=0 |
| | Gets the InputStream linked to this Socket.
|
| |
| virtual decaf::io::OutputStream * | getOutputStream ()=0 |
| | Gets the OutputStream linked to this Socket.
|
| |
| virtual int | available ()=0 |
| | Gets the number of bytes that can be read from the Socket without blocking.
|
| |
| virtual void | close ()=0 |
| | Closes the socket, terminating any blocked reads or writes.
|
| |
| virtual void | shutdownInput ()=0 |
| | Places the input stream for this socket at "end of stream".
|
| |
| virtual void | shutdownOutput ()=0 |
| | Disables the output stream for this socket.
|
| |
| virtual int | getOption (int option) const =0 |
| | Gets the specified Socket option.
|
| |
| virtual void | setOption (int option, int value)=0 |
| | Sets the specified option on the Socket if supported.
|
| |
| int | getPort () const |
| | Gets the port that this socket has been assigned.
|
| |
| int | getLocalPort () const |
| | Gets the value of this SocketImpl's local port field.
|
| |
| std::string | getInetAddress () const |
| | Gets the value of this SocketImpl's address field.
|
| |
| const decaf::io::FileDescriptor * | getFileDescriptor () const |
| | Gets the FileDescriptor for this Socket, the Object is owned by this Socket and should not be deleted by the caller.
|
| |
| virtual std::string | getLocalAddress () const =0 |
| | Gets the value of the local Inet address the Socket is bound to if bound, otherwise return the InetAddress ANY value "0.0.0.0".
|
| |
| std::string | toString () const |
| | Returns a string containing the address and port of this Socket instance.
|
| |
| virtual bool | supportsUrgentData () const |
| |
| virtual void | sendUrgentData (int data) |
| | Sends on byte of urgent data to the Socket.
|
| |
| virtual | ~SocketOptions () |
| |
Platform-independent implementation of the socket interface.