iNetworkSocket2 Struct Reference
A network socket. More...
#include <socket2.h>
Inheritance diagram for iNetworkSocket2:

Public Methods | |
virtual bool | IsConnected () const=0 |
Returns true if the connection is TCP and the socket is connected. | |
virtual int | LastError () const=0 |
Returns last driver error (see CS_NET_SOCKET_FOO in inetwork/driver2.h). | |
virtual int | SetSocketBlock (bool block)=0 |
Sets the socket blocking operation if block is true, or unsets the blocking operation if block is false. | |
virtual int | SetSocketReuse (bool reuse)=0 |
Sets the reuse option on a server socket if reuse is true, otherwise the reuse option is unset. | |
virtual int | SetSocketBroadcast (bool broadcast)=0 |
Sets the broadcast option on socket if broadcast is true, otherwise the broadcast option is unset. | |
virtual int | SetBroadcastOptions (int port, const char *addr=0)=0 |
Sets the broadcast port and address (0 means broadcast to all). | |
virtual int | Connect (char const *host, int port)=0 |
Connect to the hostname host on port port. | |
virtual int | Send (char const *buff, size_t size)=0 |
Send size bytes of buff to remote connection. | |
virtual int | Recv (char *buff, size_t size)=0 |
Read size of bytes from connection into buff. | |
virtual int | Close ()=0 |
Closes the network socket. The socket is unusible after this call. | |
virtual int | Disconnect ()=0 |
Disconnects the socket connection. Then calls closes the socket. | |
virtual int | WaitForConnection (int source, int port, int queue)=0 |
Binds to the interface source on port port. | |
virtual iNetworkSocket2 * | Accept ()=0 |
Returns a NetworkSocket2 instance for the new connection. | |
virtual int | ReadLine (char *buff, size_t size)=0 |
Performs a buffered read on either TCP or UDP connections until size bytes is reached or '\r' or '\0' is received. | |
virtual char const * | RemoteName () const=0 |
Returns a string containing either the IP or hostname of the remote connection. |
Detailed Description
A network socket.Network sockets are created via invocations of iNetworkDriver2::CreateSocket().
Definition at line 35 of file socket2.h.
Member Function Documentation
|
Returns a NetworkSocket2 instance for the new connection. Returns 0 on error. Use LastError() for the actual error. |
|
Closes the network socket. The socket is unusible after this call.
|
|
Connect to the hostname host on port port. Returns CS_NET_SOCKET_NOERROR if there is no error. |
|
Disconnects the socket connection. Then calls closes the socket.
|
|
Returns true if the connection is TCP and the socket is connected. Returns false if the connection is TCP and the socket is not connected, or the connection is UDP. |
|
Returns last driver error (see CS_NET_SOCKET_FOO in inetwork/driver2.h).
|
|
Performs a buffered read on either TCP or UDP connections until size bytes is reached or '\r' or '\0' is received. Returns number of bytes read into buff when complete. Returns 0 when line is incomplete. Returns -1 upon error. Use LastError() for the actual error. |
|
Read size of bytes from connection into buff. Returns number of bytes stored in buff or -1 on error. This function doesn't block on UDP connections. If connection is UDP then this function returns CS_NET_SOCKET_NODATA if nothing was read. Use LastError() for the actual error. |
|
Returns a string containing either the IP or hostname of the remote connection.
|
|
Send size bytes of buff to remote connection. Returns number of bytes sent or -1 on error. Use LastError() for the actual error. |
|
Sets the broadcast port and address (0 means broadcast to all). Returns CS_NET_SOCKET_NOERROR if there is no error. Function working only for UDP socket type. |
|
Sets the socket blocking operation if block is true, or unsets the blocking operation if block is false. Returns CS_NET_SOCKET_NOERROR if there is no error. |
|
Sets the broadcast option on socket if broadcast is true, otherwise the broadcast option is unset. Returns CS_NET_SOCKET_NOERROR if there is no error. Function working only for UDP socket type. |
|
Sets the reuse option on a server socket if reuse is true, otherwise the reuse option is unset. Returns CS_NET_SOCKET_NOERROR if there is no error. |
|
Binds to the interface source on port port. `source' is a numeric representation of a host address stored in network byte order, such as those returned by inet_addr(). `port' is the port number in host byte order on which to listen. Listens on bound socket - queing up to `queue' number of connections. Returns CS_NET_SOCKET_NOERROR if there is no error. |
The documentation for this struct was generated from the following file:
- inetwork/socket2.h
Generated for Crystal Space by doxygen 1.2.18