Skip to content

Commit 5e130f2

Browse files
authored
Create README.md
1 parent 176a9ce commit 5e130f2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

hw1/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Implement a 'netstat -nap'-like program
2+
In this homework, you have to implement a 'netstat -nap' tool by yourself. You have to list all the existing TCP and UDP connections. For each identified connection (socket descriptor), find the corresponding process name and its command lines that creates the connection (socket descriptor). **You have to implement all the features by yourself and cannot make calls to the system built-in netstat program nor parse output from 'netstat -nap'.** Your codes must be implemented in C and/or C++.
3+
4+
To provide more flexibilities, your program have to accept several predefined options, including
5+
6+
- -t or --tcp: list only TCP connections.
7+
- -u or --udp: list only UDP connections.
8+
- An optional string to list only command lines that containing the string.
9+
10+
You have to handle the additional options using getopt_long function. In short, the synopsis of homework #1 would be:
11+
12+
```$ ./hw1 [-t|--tcp] [-u|--udp] [filter-string]```
13+
14+
When no argument is passed, your program should output all identified connections. You may test your program with a root account so that your program would be able to access /proc files owned by other users.

0 commit comments

Comments
 (0)