-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.h
More file actions
41 lines (29 loc) · 804 Bytes
/
server.h
File metadata and controls
41 lines (29 loc) · 804 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
/*
This is a lightweight TCP server socket
Provides a create, destoy, send, and recieve
message functions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
struct Server_Socket {
int port_number, client_file_desc, file_desc ;
struct sockaddr_in server_address, client_address;
struct hostent *server;
char buffer[256];
};
struct Server_Socket* create_server(int port);
void lis_acpt(struct Server_Socket* sock);
//void send_message(struct Server_Socket* sock, char* message);
void destroy_server(struct Server_Socket* sock);
void rec_message(struct Server_Socket* sock);
#ifdef __cplusplus
}
#endif