Go to the source code of this file.
Classes |
|
class | smallset_t |
checks whether data is avaiable on sockets More... |
|
Defines |
|
#define | UDP_MSG_SIZE 512 /**< Maximum size of an UDP packet. */ |
#define | TCP_MSG_SIZE 65536 /**< Maximum size of a TCP packet. */ |
#define | DNS_PORT 53 /**< Default port for DNS. */ |
#define | T_UDP 1 /**< Constant for UDP connections. */ |
#define | T_TCP 2 /**< Constant for TCP connections. */ |
Typedefs |
|
typedef sockaddr_storage | _addr |
address type |
|
Functions |
|
int | udpcreateserver (_addr *a) |
void | udpclose (int sockid) |
int | udpread (int sockid, char *buff, int len, _addr *addr) |
void | udpsend (int sockid, char *buff, int len, _addr *addr) |
int | tcpcreateserver (_addr *a) |
int | tcpopen (_addr *a) |
void | tcpclose (int sockid) |
int | tcpaccept (int sockid, _addr *addr) |
int | tcpsend (int sockid, char *buff, int len) |
void | tcpsendall (int sockid, char *buff, int len, int maxtime) |
int | tcpread (int sockid, char *buff, int len) |
void | tcpreadall (int sockid, char *buff, int len, int maxtime) |
bool | tcpisopen (int sockid) |
void | getaddress_ip4 (_addr *res, const char *ipv4_data, int port=0) |
void | getaddress_ip6 (_addr *res, const char *ipv6_data, int port=0) |
void | getaddress (_addr *res, const char *data, int port=0) |
bool | address_lookup (_addr *res, const char *name, int port) |
void | addr_setport (_addr *addr, int port) |
int | addr_getport (_addr *addr) |
bool | address_matches (_addr *a1, _addr *a2) |
bool | addrport_matches (_addr *a1, _addr *a2) |
bool | sock_is_ipv6 (_addr *a) |
bool | addr_is_ipv6 (_addr *a) |
bool | sock_is_ipv4 (_addr *a) |
bool | addr_is_ipv4 (_addr *a) |
char * | get_ipv4_ptr (_addr *a) |
char * | get_ipv6_ptr (_addr *a) |
stl_string | addr_to_string (_addr *addr, bool include_port=true) |
int | getprotocolbyname (const char *name) |
returns the internet protocol ID from name |
|
int | getserviceportbyname (const char *name) |
returns the internet service port from name |
|
Variables |
|
bool | posclient_quitflag |
System-indepent socket functions.
Definition in file socket.h.
|
Default port for DNS. |
|
Constant for TCP connections. |
|
Constant for UDP connections. |
|
Maximum size of a TCP packet. |
|
Maximum size of an UDP packet. |
|
address type This type offers a system-independent type representing an IPv4/IPv6 address. Internally, this is a typedef to sockaddr_storage. |
|
Gets the port of an _addr structure. |
|
Checks whether the address is an IPv6 address. |
|
Checks whether the address is an IPv4 address. |
|
Sets the port of an _addr structure. |
|
Converts the _addr structure to a human-readable string. |
|
Looks up the specified domain name using the system resolver, and creates an _addr structure. |
|
Checks whether both _addr structures point to the same address. |
|
Checks whether both _addr structures point to the same address and port. |
|
Returns pointer to the four bytes of the IPv4 address. |
|
Returns pointer to the sixteen bytes of the IPv6 address. |
|
Converts an textual address (either IPv4/IPv6) to an _addr structure. |
|
Converts an IPv4 textual address to an _addr structure. |
|
Converts an IPv6 textual address to an _addr structure. |
|
returns the internet protocol ID from name Uses the system's getprotobyname() function to look up the service ID for a given protocol (usually, "udp" or "tcp"). Additionally, if the given string is a number, it will return that number.
|
|
returns the internet service port from name Uses the system's getservbyname() function to look up the port for a given service (for example, "http" or "ftp"). Additionally, if the given string is a number, it will return that number.
|
|
Checks whether the address is an IPv6 address (obsolete, use addr_is_ipv4). |
|
Checks whether the address is an IPv4 address (obsolete, use addr_is_ipv6). |
|
Accepts a client connection on a TCP server connection. |
|
Closes a TCP client/server connection. |
|
Opens a TCP server at the specified address/port, returning the socket id. |
|
Checks whether the TCP connection is still open. |
|
Opens a TCP client connection to the specified server. |
|
Reads data from the TCP connection. Doesn't guarantee all data is read, but returns immediately. |
|
Reads |
|
Sends data through the TCP connection. Doesn't guarantee all data is sent, but returns immediately. |
|
Sends all data through the TCP connection. Take at most |
|
Closes an UDP connection, both server and client. |
|
Opens an UDP server at the specified address/port, returning the socket id. |
|
Reads data from an UDP connection. The address of the sender is put in addr. |
|
Sends data to the specified server through UDP. |
|
Set to true if you want to close down your application when sockets might still be active. |