blob: 1a4970946d81710ff081f1396db2253cbd931f45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* Created by yuuta on 7/23/22.
*/
#ifndef ACRONC_NET_H
#define ACRONC_NET_H
#include <stdint.h>
#include <stddef.h>
#ifdef WIN32
#include <winsock2.h>
#else
#define SOCKET int
#endif
#define NET_CLOSED -2
#define NET_TIMEOUT -1
int net_connect(const char *host,
uint16_t port,
SOCKET *sock);
int net_read(const SOCKET *sock,
void *buffer,
size_t length,
size_t *read,
unsigned int timeout);
int net_send(const SOCKET *sock,
const void *buffer,
size_t len);
void net_close(const SOCKET *sock);
int net_init(void);
void net_free(void);
char *net_strerror(int errnum);
#endif /* ACRONC_NET_H */
|