## Task 2
### Structure
***
1. **lib:** .jar files downloaded from [apache](https://archive.apache.org/dist/ws/xmlrpc/binaries/). the downloaded file is extracted and the contents of the `lib` directory copied in here.
2. **out:** output binaries in packages `server` and `client`
3. **src:** source code in 2 packages `client` and `server`
### How to run
***
1. First we compile the code (in linux using the following command)
```bash
# the "lib/*" tells jvm to include these libraries
javac -cp "lib/*" -d out $(find src -name "*.java")
```
2. Then we start the server. again run the following command
```bash
java -cp "out:lib/*" server.Server
```
3. And finaly we run the client as such
```bash
java -cp "out:lib/*" client.Client
```
### inspecting packets using wireshark.
***
#### Normal functions
***
I installed wireshark-cli and run
```bash
sudo tshark -i lo -f "tcp port 8080" -z follow,tcp,ascii,0
```
In Client program the interaction looked like this
```
Enter an integer: 4
Enter an integer: 6
The sum is: 10
```
And the output of wireshark was as follows
```xml
POST /RPC2 HTTP/1.1
Content-Type: text/xml
User-Agent: Apache XML RPC 3.0 (Sun HTTP Transport)
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Accept: */*
Connection: keep-alive
Content-Length: 195
sample.sum
4
6
HTTP/1.1 200 OK
Server: Apache XML-RPC 1.0
Connection: close
Content-Type: text/xml
Content-Length: 129
10
```
I believe this is the expected result.
***
#### Intentional error
I changed the messge call string to `sample.add` instead of the correct `sample.sum` and run the program. obviously it threw an exception. the http response from wireguard was as follows
```xml
POST /RPC2 HTTP/1.1
Content-Type: text/xml
User-Agent: Apache XML RPC 3.0 (Sun HTTP Transport)
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Accept: */*
Connection: keep-alive
Content-Length: 196
sample.add
23
4
HTTP/1.1 200 OK
Server: Apache XML-RPC 1.0
Connection: close
Content-Type: text/xml
Content-Length: 265
faultCode
0
faultString
No such handler: sample.add
```
Again the expected results. I only tested it in one machine. so time will be done may be another time.