-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.h
More file actions
40 lines (28 loc) · 753 Bytes
/
client.h
File metadata and controls
40 lines (28 loc) · 753 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
/*
This is a lightweight client 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 Client_Socket {
int port_number, file_desc, num_char_read;
struct sockaddr_in server_address;
struct hostent *server;
char buffer[256];
};
struct Client_Socket* create_client(int port, char* hostname);
void send_message(struct Client_Socket* sock, char* message);
void destroy_client(struct Client_Socket* sock);
void rec_message(struct Client_Socket* sock);
#ifdef __cplusplus
}
#endif