-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnc.h
36 lines (34 loc) · 814 Bytes
/
snc.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
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include <netdb.h>
#include <arpa/inet.h>
void *read_thread_tcp(void *void_ptr);
void *write_thread_tcp(void *void_ptr);
void *read_thread_udp(void *void_ptr);
void *write_thread_udp(void *void_ptr);
int listen_and_accept_connection();
int connect_to_server();
int create_udp_server();
int create_udp_client();
int create_socket(int uflag);
void print_invalid_params();
void print_internal_error();
int socket_fd;
int close_threads;
int port;
int kflag;
char *hostname = NULL;
char *source_ip = NULL;
struct sockaddr_in addr;
pthread_t read_t;
pthread_t write_t;
int bufsize;
struct in_addr ip_address;