-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclientServer.h
More file actions
47 lines (37 loc) · 867 Bytes
/
clientServer.h
File metadata and controls
47 lines (37 loc) · 867 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
43
44
45
46
47
#ifndef __CLIENTSERVER_H
#define __CLIENTSERVER_H
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdarg.h>
#include <errno.h>
//localhost
#define LOCALHOST "127.0.0.1"
#define MYPORT 8080
//strings
#define SERVER "Server"
#define CLIENT "Client"
//for beauty)
#define SA struct sockaddr
//struct for arguments in pthread_create
typedef struct funcArgc_tag {
int fd;
char *buff;
} funcArgc_t;
int Server();
int Client();
//thread func
void create_thread(pthread_t *thread, void *p_func, funcArgc_t *s_struct);
void join_thread(pthread_t *thread);
//read/write to socket
void* Read(void *args);
void* Write(void *args);
//error print and ixit(1)
void err_n_die(const char *format, ...);
#endif