-
Notifications
You must be signed in to change notification settings - Fork 2
/
es2.h
53 lines (42 loc) · 948 Bytes
/
es2.h
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
46
47
48
49
50
51
52
53
#pragma once
#ifndef ES2_H
#define ES2_H
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include<winsock2.h>
#include <windows.h>
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define ENCODED 1
#pragma comment(lib,"ws2_32.lib")
#ifdef __cplusplus
extern "C" {
#endif
typedef struct response {
char* data;
int buf_sz;
} response;
extern struct sockaddr_in server, host, client;
extern WSADATA wsaData;
extern SOCKET ss, conns, cs;
extern char rep[10000];
extern int alive_;
typedef struct c_i {
char* ip;
int port;
} i_tup;
int es_init();
BOOL alive();
int es_bind(int port);
int es_listen(int nc);
i_tup es_accept();
int es_connect(const char* ip, int port);
int es_send(const char* msg, int mode);
response es_recv(int rcv_s, int mode, int timeout);
int es_cleanup();
#ifdef __cplusplus
}
#endif
#endif