makefile
Text-server.cpp Text-server.h
Text-client.cpp Text-client.h
Makefile is to complile text-server.cpp and text-client.cpp. Header files contain function declarations, macro definitions and types used in source code.
Class:DomainSocketClient: to establish a domain socket used both in server and client to connect.
Text-server.cpp:
int main: the main class to execute RunServer. Void RunServer: the main function of:
- Create a socket;
- Bind socket to address for there server;
- Listen for connections from clients;
- Accept connection from a client;
- Receive file name from client;
- Receive search string from client;
- Read the files;
- Send quit signal to client.
Text-client.cpp:
int main: the main class to execute RunClient. Void RunClient: the main function of:
- Open the socket;
- Connet to existing socket;
- Write to socket;
- Send file name to server, wait for server;
- Send search string to server, wait for server;
- Wait for server to send matched lines in the file;
- Print out total bytes received.