1
0
Fork 0

In order to support both IPv4 and IPv6 store a type struct sockaddr. Also remove specifying af_family as an arg. It will be determined using a getaddrinfo() func.

This commit is contained in:
Alexander Andreev 2024-03-24 19:38:00 +04:00
parent d5f6739fcd
commit 58645aae4b
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
1 changed files with 3 additions and 3 deletions

View File

@ -5,12 +5,12 @@
typedef struct net_t {
int fd;
struct sockaddr_in laddr, raddr, inaddr;
struct sockaddr laddr, raddr, inaddr;
socklen_t raddr_len, inaddr_len;
} net_t;
int net_client_init(net_t *const n, const int af_family, const char *const raddr, const int rport);
int net_server_init(net_t *const n, const int af_family, const char *const laddr, const int lport);
int net_client_init(net_t *const n, const char *const raddr, const char *const rport);
int net_server_init(net_t *const n, const char *const laddr, const char *const lport);
void net_destroy(net_t *n);
ssize_t net_send(net_t *const n, const char *const buf, int buf_len);