-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetFileByFirstLetter.h
More file actions
38 lines (30 loc) · 1.65 KB
/
getFileByFirstLetter.h
File metadata and controls
38 lines (30 loc) · 1.65 KB
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
/*-------------------------------------------------------------------------*
*--- ---*
*--- getFileByFirstLetter.h ---*
*--- ---*
*--- This file declares constants common to both the client and
*--- server of an application where the client asks the user for a ---*
*--- letter, and then asks a server for the text of a file that ---*
*--- begins with that letter. ---*
*--- ---*
*--- ---- ---- ---- ---- ---- ---- ---- ---- ---*
*--- ---*
*--- Version 1.0 2016 May 24 Joseph Phillips ---*
*--- ---*
*-------------------------------------------------------------------------*/
/*--- Header file inclusion ---*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h> // For socket()
#include <netinet/in.h> // For sockaddr_in and htons()
#include <netdb.h> // For getaddrinfo()
#include <errno.h> // For errno var
#include <sys/stat.h> // For open(), read(),write(), stat()
#include <fcntl.h> // and close()
/*--- Definition of constants: ---*/
#define BUFFER_LEN 256
#define NO_MATCH_CODE ((uint32_t) -1)
#define CANT_READ_FILE_CODE ((uint32_t) -2)
#define CANT_READ_DIR_CODE ((uint32_t) -3)
#define DEFAULT_HOSTNAME "localhost.localdomain"