-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmq_socket.h
More file actions
42 lines (34 loc) · 916 Bytes
/
Copy pathmq_socket.h
File metadata and controls
42 lines (34 loc) · 916 Bytes
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
/*
* Copyright (C) 2014 zomoe
*
* zomoemq may be copied only under the terms of the GNU General Public License V3
* mail : xianszm007@gmail.com
* Author: zomoe
*/
#ifndef MQ_SOCKET_H_
#define MQ_SOCKET_H_
#ifdef __cplusplus
extern "C":
{
#endif
#include <unistd.h>
#include <stddef.h>
#include <sys/types.h>
#include "mq_types.h"
// socket issue !
#define BACKLOG 20
#define KEEPALIVE 1
#define LINGER 1
#define NODELAY 1
#define TIMEOUT 0
#define NOT_USE_NONBLOCK 0
//enable non_blocking as default !
int set_nonblocking(int fd);
int sockfd_create(const char *ip_addr,int port,struct sockaddr_in *socket_addr, size_t timeout);
int client_socket_init(const char *ip_addr, int port, size_t timeout);
int server_socket_init(const char *ip_addr, int port, size_t timeout);
int do_accept_issue(int listenfd);
#ifdef __cplusplus
}
#endif
#endif