fnet.c

Simple C networking library
git clone git://git.finwo.net/lib/fnet.c
Log | Files | Refs | README

commit c0eaddb574cc0284ba54aacd861c862cd916e151
parent 8776c24643f71b82ad07284d0fe54075b6af5ed7
Author: Yersa Nordman <yersa@finwo.nl>
Date:   Mon, 23 Oct 2023 21:22:19 +0200

Use closesocket everywhere, not just in fnet_close

Diffstat:
Msrc/fnet.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/fnet.c b/src/fnet.c @@ -368,12 +368,20 @@ struct fnet_t * fnet_connect(const char *address, uint16_t port, const struct fn // Skip found address on failure to connect if (connect(fd, addrinfo->ai_addr, sizeof(struct sockaddr))) { +#if defined(_WIN32) || defined(_WIN64) + closesocket(fd); +#else close(fd); +#endif continue; } if (setnonblock(fd) < 0) { +#if defined(_WIN32) || defined(_WIN64) + closesocket(fd); +#else close(fd); +#endif fprintf(stderr, "setnonblock\n"); fnet_free((struct fnet_t *)conn); freeaddrinfo(addrs);