Skip to content

Commit 5ef7e64

Browse files
committed
Some changes in the README.md
1 parent 579ca10 commit 5ef7e64

File tree

6 files changed

+85
-317
lines changed

6 files changed

+85
-317
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif (WIN32)
2121

2222
if (WIN32)
2323
project(gopherWinPipeProcess C)
24-
add_executable(gopherWinPipeProcess main2.c general/include/definitions.h windows/lib/utils/windows_utils.c windows/include/windows_utils.h)
24+
add_executable(gopherWinPipeProcess main_LogProcess.c general/include/definitions.h windows/lib/utils/windows_utils.c windows/include/windows_utils.h)
2525
endif (WIN32)
2626
if (WIN32)
2727
project(gopherWinHandleRequestProcess C)

README.md

+54-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
# GOPHER-PROJECT
2+
This is a Gopher server written purely in C. It was presented as a project for the System Programming course under the supervision of professor Massimo Bernaschi.
3+
As required for the exam, in addition to the implementation of the Gopher server, it is necessary to develop a process for writing Logs, using the 'Select' and other features to increase the total complexity of the project.
4+
The software is compatible with both Windows 10 and Linux.
5+
# Getting Started
26

3-
# would
7+
## How to install
8+
Compile with CMakeLists.txt, this software is compatible with Linux and Windows 10.
9+
Execute the following command in the cmake-build-debug folder.
10+
```sh
11+
$ cmake
12+
$ make
13+
$ ./gopherLinux
14+
```
15+
The structure of this project is 100% compatible with Clion and other JetBrains products.
16+
## CommandLine Option
17+
For each option having {param}, replace param with an appropriate argument.<br>
18+
* **-d "{param}"** (as Directory) followed with the path to use as root for sending files. Use of the spaces in the path are allowed.
19+
* **-m {param}** (as Mode_Concurrency) followed with the string 'Thread' or 'Process' for the selection of the parallel mode for sending requests.
20+
* **-p {param}** (as Port) replace param with the integer for specify the port to use
21+
* **-i {param}** replace param with a string for specify the hostname.
22+
* **-e** to enable daemon mode.
23+
* **-s** (as Security) to enable protection for the DOS attack.
424

5-
- Aggiungere che non ci sia nessun parametro settato come NULL nella struttura di configurazione
25+
## Configuration File
26+
All params are required.
27+
<br> Examples of Configuration File:
28+
```
29+
port 7080
30+
root_dir "./rootDirectory/"
31+
mode_concurrency Thread
32+
external_ip cloud.myservergopher.com
33+
```
34+
```
35+
port 7000
36+
root_dir "~/gopher_root/"
37+
mode_concurrency Process
38+
external_ip gopher.theprotocol.it
39+
```
40+
# Tests
41+
The Gopher server supports more than 50.000 requests simultaneously. Has limited use of memory, tests with Valgrind report zero errors or warnings. <br>
42+
You can find the stress script in the root of the project, It's a file bash called stressCurl.sh
43+
## Operating System tested
44+
##### Windows 10
45+
##### Linux:
46+
* **Arch Linux**
47+
* **Manjaro**
48+
* **Debian 9.x**
49+
50+
# Known Issues
51+
Lost the compatibility with macOS due to an unresolved Apple bug. 90% of the software is compatible with macOS X Mojave. <br>
52+
Lost the compatibility with Ubuntu, it's easy to fix. <br>
53+
54+
# Authors
55+
56+
* **Andrea Bacciu** - [github](https://github.com/andreabac3)
57+
* **Valerio Neri** - [github](https://github.com/ValerioNeriGit)

Relazione.pdf

122 KB
Binary file not shown.

main2.c

-128
This file was deleted.

main_LogProcess.c

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <math.h>
4+
#include <definitions.h>
5+
#include <windows_utils.h>
6+
#include <stdbool.h>
7+
8+
int main(int argc, char *argv[]) {
9+
HANDLE eventReadyToReadPipe = CreateEventA(NULL, FALSE, TRUE, "eventReadyToReadPipe");
10+
do {
11+
WaitForSingleObject(eventReadyToReadPipe, INFINITE);
12+
HANDLE child_std_out = GetStdHandle(STD_OUTPUT_HANDLE);
13+
char buf[BUFFER_SIZE * 2] = {0};
14+
DWORD numRead;
15+
16+
if (ReadFile(child_std_out, buf, BUFFER_SIZE * 2, &numRead, NULL)) {
17+
fprintf(stderr, "NumRead PIPE%d \n%s %s\n", numRead, buf, argv[1]);
18+
FILE *fp_log = fopen(LOG_PATH, "a+");
19+
fprintf(fp_log, "%s", buf);
20+
fclose(fp_log);
21+
}
22+
} while (atoi(argv[1]) == M_THREAD && 0);
23+
CloseHandle(eventReadyToReadPipe);
24+
25+
26+
exit(0);
27+
}
28+
29+
30+

0 commit comments

Comments
 (0)