|
Kore 3
|
Provides low-level network-communication via UDP or TCP-sockets. More...
#include <kore3/global.h>Go to the source code of this file.
Data Structures | |
| struct | kore_socket |
| struct | kore_socket_parameters |
Enumerations | |
| enum | kore_socket_protocol { KORE_SOCKET_PROTOCOL_UDP , KORE_SOCKET_PROTOCOL_TCP } |
| enum | kore_socket_family { KORE_SOCKET_FAMILY_IP4 , KORE_SOCKET_FAMILY_IP6 } |
Functions | |
| KORE_FUNC void | kore_socket_parameters_set_defaults (kore_socket_parameters *parameters) |
| Initializes a socket-options-object to the default parameters. | |
| KORE_FUNC void | kore_socket_init (kore_socket *socket) |
| Initializes a socket-object. To set the host and port use kore_socket_set. Host will be localhost Port will be 8080 Family will be IPv4 Protocol will be TCP. | |
| KORE_FUNC bool | kore_socket_set (kore_socket *socket, const char *host, int port, kore_socket_family family, kore_socket_protocol protocol) |
| Sets the sockets properties. | |
| KORE_FUNC void | kore_socket_destroy (kore_socket *socket) |
| Destroys a socket-object. | |
| KORE_FUNC bool | kore_socket_open (kore_socket *socket, const kore_socket_parameters *parameters) |
| Opens a socket-connection. | |
| KORE_FUNC bool | kore_socket_select (kore_socket *socket, uint32_t waittime, bool read, bool write) |
| For use with non-blocking sockets to try to see if we are connected. | |
| KORE_FUNC bool | kore_socket_bind (kore_socket *socket) |
| KORE_FUNC bool | kore_socket_listen (kore_socket *socket, int backlog) |
| KORE_FUNC bool | kore_socket_accept (kore_socket *socket, kore_socket *new_socket, unsigned *remote_address, unsigned *remote_port) |
| KORE_FUNC bool | kore_socket_connect (kore_socket *socket) |
| KORE_FUNC int | kore_socket_send (kore_socket *socket, const uint8_t *data, int size) |
| KORE_FUNC int | kore_socket_send_address (kore_socket *socket, unsigned address, int port, const uint8_t *data, int size) |
| KORE_FUNC int | kore_socket_send_url (kore_socket *socket, const char *url, int port, const uint8_t *data, int size) |
| KORE_FUNC int | kore_socket_receive (kore_socket *socket, uint8_t *data, int maxSize, unsigned *from_address, unsigned *from_port) |
| KORE_FUNC unsigned | kore_url_to_int (const char *url, int port) |
| Resolves a DNS-entry to an IP and returns its integer representation. | |
Provides low-level network-communication via UDP or TCP-sockets.
| KORE_FUNC void kore_socket_destroy | ( | kore_socket * | socket | ) |
Destroys a socket-object.
| socket | The socket to destroy |
| KORE_FUNC void kore_socket_init | ( | kore_socket * | socket | ) |
Initializes a socket-object. To set the host and port use kore_socket_set. Host will be localhost Port will be 8080 Family will be IPv4 Protocol will be TCP.
| socket | The socket to initialize |
| KORE_FUNC bool kore_socket_open | ( | kore_socket * | socket, |
| const kore_socket_parameters * | parameters ) |
Opens a socket-connection.
| socket | The socket-object to use |
| protocol | The protocol to use |
| port | The port to use |
| options | The options to use |
| KORE_FUNC void kore_socket_parameters_set_defaults | ( | kore_socket_parameters * | parameters | ) |
Initializes a socket-options-object to the default parameters.
| options | The new default options |
| KORE_FUNC bool kore_socket_select | ( | kore_socket * | socket, |
| uint32_t | waittime, | ||
| bool | read, | ||
| bool | write ) |
For use with non-blocking sockets to try to see if we are connected.
| socket | The socket-object to use |
| waittime | The amount of time in seconds the select function will timeout. |
| read | Check if the socket is ready to be read from. |
| write | Check if the socket is ready to be written to. |
| KORE_FUNC bool kore_socket_set | ( | kore_socket * | socket, |
| const char * | host, | ||
| int | port, | ||
| kore_socket_family | family, | ||
| kore_socket_protocol | protocol ) |
Sets the sockets properties.
| socket | The socket-object to use |
| host | The host to use as IP or URL |
| port | The port to use |
| family | The IP-family to use |
| protocol | The protocol to use |
| KORE_FUNC unsigned kore_url_to_int | ( | const char * | url, |
| int | port ) |
Resolves a DNS-entry to an IP and returns its integer representation.
| url | |
| port |