mirror of
https://github.com/pumpitupdev/pumptools.git
synced 2026-09-28 09:47:55 +03:00
45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
//
|
|
// Created by on 9/16/18.
|
|
//
|
|
|
|
#ifndef UTIL_SOCK_TCP_H
|
|
#define UTIL_SOCK_TCP_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
extern const int INVALID_SOCK_HANDLE;
|
|
|
|
bool util_sock_tcp_is_connectable(const char* ipv4, uint32_t timeout_ms);
|
|
|
|
bool util_sock_tcp_is_connectable2(const char* ipv4, uint16_t port, uint32_t timeout_ms);
|
|
|
|
bool util_sock_tcp_is_connectable3(uint32_t ipv4, uint16_t port, uint32_t timeout_ms);
|
|
|
|
int util_sock_tcp_open_bind_listen(const char* ipv4, uint32_t num_connections);
|
|
|
|
int util_sock_tcp_open_bind_listen2(const char* ipv4, uint16_t port, uint32_t num_connections);
|
|
|
|
int util_sock_tcp_open_bind_listen3(uint32_t ipv4, uint16_t port, uint32_t num_connections);
|
|
|
|
int util_sock_tcp_wait_and_accept_remote_connection(int handle);
|
|
|
|
int util_sock_tcp_connect(const char* ipv4);
|
|
|
|
int util_sock_tcp_connect2(const char* ipv4, uint16_t port);
|
|
|
|
int util_sock_tcp_connect3(uint32_t ipv4, uint16_t port);
|
|
|
|
ssize_t util_sock_tcp_send_block(int handle, const void* buffer, size_t size);
|
|
|
|
ssize_t util_sock_tcp_send(int handle, const void* buffer, size_t size, uint32_t timeout_ms);
|
|
|
|
ssize_t util_sock_tcp_recv_block(int handle, void* buffer, size_t size);
|
|
|
|
ssize_t util_sock_tcp_recv(int handle, void* buffer, size_t size, uint32_t timeout_ms);
|
|
|
|
void util_sock_tcp_close(int handle);
|
|
|
|
#endif
|