TinyCSocket¶
Tinycsocket is a thin cross-platform socket library written in C99. It focuses on a minimal footprint, cross-platform and to also provide simple lowlevel utils (for example tcs_simple_connect(…) which resolves and connects to a hostname). The API is similar to BSD sockets with some differences. All functions return an error-code. The advantage is that the error handling is simple to understand and to handle for all plattforms. The disadvantage is that the functions can not be easily integrated in expressions.
Currently support plattforms:
- Windows 2000 SP1 and newer (XP, Server 2003, Vista, Server 2008, 7, 8, 8.1 and 10)
- POSIX.1-2001 systems
Installation Instructions¶
Depending on if you use cmake or not there are two installation instructions.
Integrate with CMake¶
If you are using a cmake project, it is recommended to include tinycsocket to your build system. Add this repo as a submodule and add tinycsocket/src to your CMakeLists.txt.
git submodule add https://gitlab.com/dosshell/tinycsocket.git
add_subdirectory(tinycsocket/src)
target_link_libraries(your_target PRIVATE tinycsocket)
You can read more about how to use submodules here: https://git-scm.com/book/en/v2/Git-Tools-Submodules
Manually Linking¶
You can also build this project to get a lib directory and an include directoy. Generate a build-system out of tinycsocket with cmake and build the install target. Don’t forget that if you are targeting Windows you also need to link to wsock32.lib and ws2_32.lib. The following commands will create these include- and lib folders in a folder named install:
git clone https://gitlab.com/dosshell/tinycsocket.git
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:Path=../install ../tinycsocket
cmake --build . --target INSTALL --config Release
You can now remove the build directory and the tinycsocket directory if you like.
Reference Documentation¶
This is the part you probably are looking for.
List of All Functions¶
List of all available functions in TinyCSocket:
symbol | description |
---|---|
tcs_util_ipv4_args | Plattform independent utility function to compose an IPv4 address from 4 bytes. |
tcs_util_string_to_address | Plattform independent parsing of a string to an IPv4 address. |
tcs_util_address_to_string | Plattform independent parsing of an IPv4 address to a string. |
tcs_lib_init | Call this to initialize the library, eg. call this before any other function. |
tcs_lib_free | Call this when you are done with tinycsocket lib to free resources. |
tcs_create | Creates a new socket. |
tcs_create_ext | Creates a new socket with BSD-style options such family, type and protocol. |
tcs_bind | Binds a socket to local_port on all interfaces. |
tcs_bind_address | Binds a socket to a local address. |
tcs_connect | Connect a socket to a remote hostname and port. |
tcs_connect_address | Connects a socket to a remote address. |
tcs_listen | Let a socket start listening for incoming connections. |
tcs_listen_to | Bind a socket to a local portnumber and start listening to new connections. |
tcs_accept | Accept a socket from a listening socket. |
tcs_send | Sends data on a socket, blocking. |
tcs_send_to | Sends data to an address, useful with UDP sockets. |
tcs_receive | Receive data from a socket to your buffer. |
tcs_receive_from | Receive data from an address, useful with UDP sockets. |
tcs_pool_create | |
tcs_pool_destory | |
tcs_pool_add | |
tcs_pool_remove | |
tcs_pool_poll | |
tcs_set_option | Set parameters on a socket. It is recommended to use tcs_set_xxx instead. |
tcs_get_option | |
tcs_shutdown | Turn off communication with a 3-way handshaking for the socket. |
tcs_destroy | Closes the socket, call this when you are done with the socket. |
tcs_resolve_hostname | Get addresses you can connect to given a computer name. |
tcs_local_interfaces | Get local addresses of your computer. |
tcs_set_broadcast | |
tcs_get_broadcast | |
tcs_set_keep_alive | |
tcs_get_keep_alive | |
tcs_set_reuse_address | |
tcs_get_reuse_address | |
tcs_set_send_buffer_size | |
tcs_get_send_buffer_size | |
tcs_set_receive_buffer_size | |
tcs_get_receive_buffer_size | |
tcs_set_receive_timeout | |
tcs_get_receive_timeout | |
tcs_set_linger | |
tcs_get_linger | |
tcs_set_ip_no_delay | |
tcs_get_ip_no_delay | |
tcs_set_out_of_band_inline | |
tcs_get_out_of_band_inline | |
tcs_set_ip_multicast_add | |
tcs_set_ip_multicast_drop | |
tcs_receive_netstring | |
tcs_send_netstring |
List of All Constants¶
List of all available constants in TinyCSocket:
symbol | description |
---|---|
const struct TcsAddress TCS_ADDRESS_NULL | |
const uint32_t TCS_ADDRESS_ANY_IP4 | |
const uint32_t TCS_ADDRESS_LOOPBACK_IP4 | |
const uint32_t TCS_ADDRESS_BROADCAST_IP4 | |
const uint32_t TCS_ADDRESS_NONE_IP4 | |
const TcsSocket TCS_NULLSOCKET | An empty socket, you should always define your new sockets to this value |
const uint32_t TCS_NO_FLAGS | |
const int TCS_SOCK_STREAM | Use for streaming types like TCP |
const int TCS_SOCK_DGRAM | Use for datagrams types like UDP |
const int TCS_IPPROTO_TCP | Use TCP protocol (use with TCS_SOCK_STREAM for normal cases) |
const int TCS_IPPROTO_UDP | Use UDP protocol (use with TCS_SOCK_DGRAM for normal cases) |
const uint32_t TCS_AI_PASSIVE | Use this flag for pure listening sockets |
const uint32_t TCS_MSG_PEEK | |
const uint32_t TCS_MSG_OOB | |
const uint32_t TCS_MSG_WAITALL | |
const uint32_t TCS_MSG_SENDALL | |
const int TCS_BACKLOG_SOMAXCONN | Max number of queued sockets when listening |
const int TCS_SOL_SOCKET | Socket option level for socket options |
const int TCS_SOL_IP | IP option level for socket options |
const int TCS_SO_BROADCAST | |
const int TCS_SO_KEEPALIVE | |
const int TCS_SO_LINGER | |
const int TCS_SO_REUSEADDR | This is a tricky one for crossplatform independency! |
const int TCS_SO_RCVBUF | Byte size of receiving buffer |
const int TCS_SO_RCVTIMEO | |
const int TCS_SO_SNDBUF | Byte size of receiving buffer |
const int TCS_SO_OOBINLINE | |
const int TCS_SO_IP_NODELAY | |
const int TCS_SO_IP_MEMBERSHIP_ADD | |
const int TCS_SO_IP_MEMBERSHIP_DROP | |
const int TCS_SO_IP_MULTICAST_LOOP | |
const int TCS_INF | |
const struct TcsPollEvent TCS_NULLEVENT |
Reference Details¶
This section contains details of all functions.
tcs_util_ipv4_args¶
Plattform independent utility function to compose an IPv4 address from 4 bytes.
TcsReturnCode tcs_util_ipv4_args(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint32_t *out_address)
Parameters:
type | name | description |
---|---|---|
uint8_t | a | Is the first byte |
uint8_t | b | Is the second byte |
uint8_t | c | Is the third byte |
uint8_t | d | Is the forth byte |
uint32_t * | out_address | is your ipv4 address stored as an unsigned 32bit integer. This parameter can not be NULL. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_util_string_to_address¶
Plattform independent parsing of a string to an IPv4 address.
TcsReturnCode tcs_util_string_to_address(const char str[], struct TcsAddress *out_address)
Parameters:
type | name | description |
---|---|---|
const char | str | None |
struct TcsAddress * | out_address | None |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_util_address_to_string¶
Plattform independent parsing of an IPv4 address to a string.
TcsReturnCode tcs_util_address_to_string(const struct TcsAddress *address, char out_str[40])
Parameters:
type | name | description |
---|---|---|
const struct TcsAddress * | address | |
char | out_str |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_lib_init¶
Call this to initialize the library, eg. call this before any other function.
TcsReturnCode tcs_lib_init(void)
Parameters:
type | name | description |
---|---|---|
void | None | None |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_lib_free¶
Call this when you are done with tinycsocket lib to free resources.
TcsReturnCode tcs_lib_free(void)
Parameters:
type | name | description |
---|---|---|
void | None | None |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_create¶
Creates a new socket.
TcsReturnCode tcs_create(TcsSocket *socket_ctx, TcsType socket_Type)
Parameters:
type | name | description |
---|---|---|
TcsSocket * | socket_ctx | is your in-out pointer to the socket context, you must initialize the socket to TCS_NULLSOCKET before use. |
TcsType | socket_Type | None |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_destroy()
- tcs_lib_init()
tcs_create_ext¶
Creates a new socket with BSD-style options such family, type and protocol.
TcsReturnCode tcs_create_ext(TcsSocket *socket_ctx, TcsAddressFamily family, int type, int protocol)
Parameters:
type | name | description |
---|---|---|
TcsSocket * | socket_ctx | is your in-out pointer to the socket context, you must initialize the socket to TCS_NULLSOCKET before use. |
TcsAddressFamily | family | only supports TCS_AF_IP4 for now. |
int | type | specifies the type of the socket, for example TCS_SOCK_STREAM or TCS_SOCK_DGRAM. |
int | protocol | specifies the protocol, for example TCS_IPPROTO_TCP or TCS_IPPROTO_UDP. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_destroy()
- tcs_lib_init()
tcs_bind¶
Binds a socket to local_port on all interfaces.
TcsReturnCode tcs_bind(TcsSocket socket_ctx, uint16_t local_port)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context you want bind. |
uint16_t | local_port | is your local portnumber you want to bind to. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_bind_address()
- tcs_listen()
tcs_bind_address¶
Binds a socket to a local address.
TcsReturnCode tcs_bind_address(TcsSocket socket_ctx, const struct TcsAddress *local_address)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context you want to bind. |
const struct TcsAddress * | local_address | is your local address you want to bind to. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_bind()
- tcs_get_interfaces()
- tcs_listen()
tcs_connect¶
Connect a socket to a remote hostname and port.
TcsReturnCode tcs_connect(TcsSocket socket_Ctx, const char *hostname, uint16_t port)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_Ctx | None |
const char * | hostname | None |
uint16_t | port | None |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_bind()
- tcs_get_interfaces()
- tcs_listen()
tcs_connect_address¶
Connects a socket to a remote address.
TcsReturnCode tcs_connect_address(TcsSocket socket_ctx, const struct TcsAddress *address)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
const struct TcsAddress * | address | is the remote address to connect to. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_shutdown()
tcs_listen¶
Let a socket start listening for incoming connections.
TcsReturnCode tcs_listen(TcsSocket socket_ctx, int backlog)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
int | backlog | is the maximum number of queued incoming sockets. Use TCS_BACKLOG_SOMAXCONN to set it to max. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_accept()
tcs_listen_to¶
Bind a socket to a local portnumber and start listening to new connections.
TcsReturnCode tcs_listen_to(TcsSocket socket_ctx, uint16_t local_port)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
uint16_t | local_port | None |
Returns:
<documentation is not available>
tcs_accept¶
Accept a socket from a listening socket.
TcsReturnCode tcs_accept(TcsSocket socket_ctx, TcsSocket *child_socket_ctx, struct TcsAddress *address)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your listening socket you used when you called #tcs_listen_ext(). |
TcsSocket * | child_socket_ctx | is your accepted socket. Must have the in value of TCS_NULLSOCKET. |
struct TcsAddress * | address | is an optional pointer to a buffer where the remote address of the accepted socket can be stored. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_send¶
Sends data on a socket, blocking.
TcsReturnCode tcs_send(TcsSocket socket_ctx, const uint8_t *buffer, size_t buffer_size, uint32_t flags, size_t *bytes_sent)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
const uint8_t * | buffer | is a pointer to your data you want to send. |
size_t | buffer_size | is number of bytes of the data you want to send. |
uint32_t | flags | is currently not in use. |
size_t * | bytes_sent | is how many bytes that was successfully sent. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_receive()
tcs_send_to¶
Sends data to an address, useful with UDP sockets.
TcsReturnCode tcs_send_to(TcsSocket socket_ctx, const uint8_t *buffer, size_t buffer_size, uint32_t flags, const struct TcsAddress *destination_address, size_t *bytes_sent)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
const uint8_t * | buffer | is a pointer to your data you want to send. |
size_t | buffer_size | is number of bytes of the data you want to send. |
uint32_t | flags | is currently not in use. |
const struct TcsAddress * | destination_address | is the address to send to. |
size_t * | bytes_sent | is how many bytes that was successfully sent. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_receive_from()
- tcs_getaddrinfo()
tcs_receive¶
Receive data from a socket to your buffer.
TcsReturnCode tcs_receive(TcsSocket socket_ctx, uint8_t *buffer, size_t buffer_size, uint32_t flags, size_t *bytes_received)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
uint8_t * | buffer | is a pointer to your buffer where you want to store the incoming data to. |
size_t | buffer_size | is the byte size of your buffer, for preventing overflows. |
uint32_t | flags | is currently not in use. |
size_t * | bytes_received | is how many bytes that was successfully written to your buffer. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_send()
tcs_receive_from¶
Receive data from an address, useful with UDP sockets.
TcsReturnCode tcs_receive_from(TcsSocket socket_ctx, uint8_t *buffer, size_t buffer_size, uint32_t flags, struct TcsAddress *source_address, size_t *bytes_received)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
uint8_t * | buffer | is a pointer to your buffer where you want to store the incoming data to. |
size_t | buffer_size | is the byte size of your buffer, for preventing overflows. |
uint32_t | flags | is currently not in use. |
struct TcsAddress * | source_address | is the address to receive from. |
size_t * | bytes_received | is how many bytes that was successfully written to your buffer. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
See Also:
- tcs_send_to()
- tcs_getaddrinfo()
tcs_pool_create¶
TcsReturnCode tcs_pool_create(struct TcsPool **pool)
Parameters:
type | name | description |
---|---|---|
struct TcsPool ** | pool | None |
Returns:
<documentation is not available>
tcs_pool_destory¶
TcsReturnCode tcs_pool_destory(struct TcsPool **pool)
Parameters:
type | name | description |
---|---|---|
struct TcsPool ** | pool | None |
Returns:
<documentation is not available>
tcs_pool_add¶
TcsReturnCode tcs_pool_add(struct TcsPool *pool, TcsSocket socket, void *user_data, bool poll_can_read, bool poll_can_write, bool poll_error)
Parameters:
type | name | description |
---|---|---|
struct TcsPool * | pool | None |
TcsSocket | socket | None |
void * | user_data | None |
bool | poll_can_read | None |
bool | poll_can_write | None |
bool | poll_error | None |
Returns:
<documentation is not available>
tcs_pool_remove¶
TcsReturnCode tcs_pool_remove(struct TcsPool *pool, TcsSocket socket)
Parameters:
type | name | description |
---|---|---|
struct TcsPool * | pool | None |
TcsSocket | socket | None |
Returns:
<documentation is not available>
tcs_pool_poll¶
TcsReturnCode tcs_pool_poll(struct TcsPool *pool, struct TcsPollEvent *events, size_t events_count, size_t *events_populated, int64_t timeout_in_ms)
Parameters:
type | name | description |
---|---|---|
struct TcsPool * | pool | None |
struct TcsPollEvent * | events | None |
size_t | events_count | None |
size_t * | events_populated | None |
int64_t | timeout_in_ms | None |
Returns:
<documentation is not available>
tcs_set_option¶
Set parameters on a socket. It is recommended to use tcs_set_xxx instead.
TcsReturnCode tcs_set_option(TcsSocket socket_ctx, int32_t level, int32_t option_name, const void *option_value, size_t option_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
int32_t | level | is the definition level. |
int32_t | option_name | is the option name. |
const void * | option_value | is a pointer to the option value. |
size_t | option_size | is the byte size of the data pointed by option_value. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_get_option¶
TcsReturnCode tcs_get_option(TcsSocket socket_ctx, int32_t level, int32_t option_name, void *option_value, size_t *option_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
int32_t | level | None |
int32_t | option_name | None |
void * | option_value | None |
size_t * | option_size | None |
Returns:
<documentation is not available>
tcs_shutdown¶
Turn off communication with a 3-way handshaking for the socket.
TcsReturnCode tcs_shutdown(TcsSocket socket_ctx, TcsSocketDirection direction)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | is your in-out socket context. |
TcsSocketDirection | direction | None |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_destroy¶
Closes the socket, call this when you are done with the socket.
TcsReturnCode tcs_destroy(TcsSocket *socket_ctx)
Parameters:
type | name | description |
---|---|---|
TcsSocket * | socket_ctx | is your in-out socket context. |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_resolve_hostname¶
Get addresses you can connect to given a computer name.
TcsReturnCode tcs_resolve_hostname(const char *hostname, TcsAddressFamily address_family, struct TcsAddress found_addresses[], size_t found_addresses_max_length, size_t *no_of_found_addresses)
Parameters:
type | name | description |
---|---|---|
const char * | hostname | None |
TcsAddressFamily | address_family | filters which address family you want, for example if you only are interested in IPv6. Use TCS_AF_UNSPEC to not filter. |
struct TcsAddress | found_addresses | is a pointer to your array which will be populated with found addresses. |
size_t | found_addresses_max_length | is number of elements your array can store. |
size_t * | no_of_found_addresses | will output the number of addresses that was populated in . |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_local_interfaces¶
Get local addresses of your computer.
TcsReturnCode tcs_local_interfaces(struct TcsInterface found_interfaces[], size_t found_interfaces_length, size_t *no_of_found_interfaces)
Parameters:
type | name | description |
---|---|---|
struct TcsInterface | found_interfaces | is a pointer to your array which will be populated with found interfaces. |
size_t | found_interfaces_length | is number of elements your array can store. |
size_t * | no_of_found_interfaces | will output the number of addresses that was populated in . |
Returns:
TCS_SUCCESS if successful, otherwise the error code.
tcs_set_broadcast¶
TcsReturnCode tcs_set_broadcast(TcsSocket socket_ctx, bool do_allow_broadcast)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool | do_allow_broadcast | None |
Returns:
<documentation is not available>
tcs_get_broadcast¶
TcsReturnCode tcs_get_broadcast(TcsSocket socket_ctx, bool *is_broadcast_allowed)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool * | is_broadcast_allowed | None |
Returns:
<documentation is not available>
tcs_set_keep_alive¶
TcsReturnCode tcs_set_keep_alive(TcsSocket socket_ctx, bool do_keep_alive)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool | do_keep_alive | None |
Returns:
<documentation is not available>
tcs_get_keep_alive¶
TcsReturnCode tcs_get_keep_alive(TcsSocket socket_ctx, bool *is_keep_alive_enabled)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool * | is_keep_alive_enabled | None |
Returns:
<documentation is not available>
tcs_set_reuse_address¶
TcsReturnCode tcs_set_reuse_address(TcsSocket socket_ctx, bool do_allow_reuse_address)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool | do_allow_reuse_address | None |
Returns:
<documentation is not available>
tcs_get_reuse_address¶
TcsReturnCode tcs_get_reuse_address(TcsSocket socket_ctx, bool *is_reuse_address_allowed)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool * | is_reuse_address_allowed | None |
Returns:
<documentation is not available>
tcs_set_send_buffer_size¶
TcsReturnCode tcs_set_send_buffer_size(TcsSocket socket_ctx, size_t send_buffer_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
size_t | send_buffer_size | None |
Returns:
<documentation is not available>
tcs_get_send_buffer_size¶
TcsReturnCode tcs_get_send_buffer_size(TcsSocket socket_ctx, size_t *send_buffer_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
size_t * | send_buffer_size | None |
Returns:
<documentation is not available>
tcs_set_receive_buffer_size¶
TcsReturnCode tcs_set_receive_buffer_size(TcsSocket socket_ctx, size_t receive_buffer_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
size_t | receive_buffer_size | None |
Returns:
<documentation is not available>
tcs_get_receive_buffer_size¶
TcsReturnCode tcs_get_receive_buffer_size(TcsSocket socket_ctx, size_t *receive_buffer_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
size_t * | receive_buffer_size | None |
Returns:
<documentation is not available>
tcs_set_receive_timeout¶
TcsReturnCode tcs_set_receive_timeout(TcsSocket socket_ctx, int timeout_ms)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
int | timeout_ms | None |
Returns:
<documentation is not available>
tcs_get_receive_timeout¶
TcsReturnCode tcs_get_receive_timeout(TcsSocket socket_ctx, int *timeout_ms)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
int * | timeout_ms | None |
Returns:
<documentation is not available>
tcs_set_linger¶
TcsReturnCode tcs_set_linger(TcsSocket socket_ctx, bool do_linger, int timeout_seconds)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool | do_linger | None |
int | timeout_seconds | None |
Returns:
<documentation is not available>
tcs_get_linger¶
TcsReturnCode tcs_get_linger(TcsSocket socket_ctx, bool *do_linger, int *timeout_seconds)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool * | do_linger | None |
int * | timeout_seconds | None |
Returns:
<documentation is not available>
tcs_set_ip_no_delay¶
TcsReturnCode tcs_set_ip_no_delay(TcsSocket socket_ctx, bool use_no_delay)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool | use_no_delay | None |
Returns:
<documentation is not available>
tcs_get_ip_no_delay¶
TcsReturnCode tcs_get_ip_no_delay(TcsSocket socket_ctx, bool *is_no_delay_used)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool * | is_no_delay_used | None |
Returns:
<documentation is not available>
tcs_set_out_of_band_inline¶
TcsReturnCode tcs_set_out_of_band_inline(TcsSocket socket_ctx, bool enable_oob)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool | enable_oob | None |
Returns:
<documentation is not available>
tcs_get_out_of_band_inline¶
TcsReturnCode tcs_get_out_of_band_inline(TcsSocket socket_ctx, bool *is_oob_enabled)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
bool * | is_oob_enabled | None |
Returns:
<documentation is not available>
tcs_set_ip_multicast_add¶
TcsReturnCode tcs_set_ip_multicast_add(TcsSocket socket_ctx, const struct TcsAddress *local_address, const struct TcsAddress *multicast_address)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
const struct TcsAddress * | local_address | None |
const struct TcsAddress * | multicast_address | None |
Returns:
<documentation is not available>
tcs_set_ip_multicast_drop¶
TcsReturnCode tcs_set_ip_multicast_drop(TcsSocket socket_ctx, const struct TcsAddress *local_address, const struct TcsAddress *multicast_address)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
const struct TcsAddress * | local_address | None |
const struct TcsAddress * | multicast_address | None |
Returns:
<documentation is not available>
tcs_receive_netstring¶
TcsReturnCode tcs_receive_netstring(TcsSocket socket_ctx, uint8_t *buffer, size_t buffer_size, size_t *bytes_received)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
uint8_t * | buffer | None |
size_t | buffer_size | None |
size_t * | bytes_received | None |
Returns:
<documentation is not available>
tcs_send_netstring¶
TcsReturnCode tcs_send_netstring(TcsSocket socket_ctx, const uint8_t *buffer, size_t buffer_size)
Parameters:
type | name | description |
---|---|---|
TcsSocket | socket_ctx | None |
const uint8_t * | buffer | None |
size_t | buffer_size | None |
Returns:
<documentation is not available>