Skip to content

Commit ef46225

Browse files
Update README , expand Topology
1 parent c4ceebb commit ef46225

File tree

5 files changed

+41
-2
lines changed

5 files changed

+41
-2
lines changed
1.03 KB
Binary file not shown.

Misc/Diagram.png

56.9 KB
Loading

Misc/Dockerfile.png

42.8 KB
Loading

Misc/Wireshark.pdf

20.2 KB
Binary file not shown.

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# UDP Network Socket Protocol
22

3+
![UDP Diagram](./Misc/Diagram.png)
4+
35
## Installation
46
```
57
git clone https://github.com/mangledbottles/Network-Socket-Protocol.git
@@ -35,7 +37,44 @@ npm run client
3537
> ![StartClient](./Misc/StartClient.png)
3638
> Starting the Client sends a message to the Server and the Server response with the current time
3739
40+
# Topology
41+
## Dockerfile
42+
This project has been [dockerized](./Dockerfile)
43+
> ![Dockerfile](./Misc/Dockerfile.png)
44+
45+
## Server.ts
46+
The Server.ts file contains 4 main functionalities
47+
1. Create UDP server with the dgram library
48+
2. Read user IO from the CLI
49+
3. Listen to incomining messages from Clients
50+
4. Send messages to Client(s)
51+
3852
## Broadcasting
39-
The Server can send a message to all Clients. The user types into the CLI and the Server manages the IO and broadcasts the message to all connected Clients
53+
The Server can send a message to all Clients. The user types into the CLI and the Server manages the IO and broadcasts the message to all connected Clients. To broadcast a message to all Clients, run the Docker container ([as seen above](#dockerizing-server)), then type a message into the CLI and press enter.
4054
> ![ServerBroadcastToClients](./Misc/ServerBroadcastToClients.png)
41-
> When a Client connects to the Server, their address and port are saved. When a broadcast is called, the message is sent to all addresses and ports connected
55+
> When a Client connects to the Server, their address and port are saved. When a broadcast is called, the message is sent to all addresses and ports connected. An Typescript interface has been created for Client and all Client's are stored in a Set to prevent duplicates.
56+
57+
## Client.ts
58+
The Client.ts file connects to the Server, sends a message to the Server and listens for messages from the Server.
59+
60+
## Wireshark
61+
[Wireshark](https://www.wireshark.org/) is a network packet analyzer.
62+
63+
Sample intercepted request (taken from [Wireshark PCAP File](./Misc/2ClientsConnectToServerAndServerBroadcast.pcapng))
64+
65+
66+
| No. | Time | Source | Destination | Protocol | Length | Info |
67+
| --- | ---- | ------ | ----------- | -------- | ------ | ---- |
68+
| 2 | 0.010357778 | 127.0.0.1 | 127.0.0.1 | UDP | 137 | 8080 → 60137 Len=95 |
69+
70+
---
71+
| Hexadecimal Payload | Base10 Decoded |
72+
|-|-|
73+
| 0000 48 65 6c 6c 6f 20 33 35 35 39 31 2c 20 79 6f 75 | Hello 35591, you |
74+
| 0010 20 61 72 65 20 23 30 2c 20 74 69 6d 65 20 69 73 | are #0, time is |
75+
| 0020 20 54 75 65 20 4f 63 74 20 32 36 20 32 30 32 31 | Tue Oct 26 2021 |
76+
| 0030 20 31 38 3a 32 35 3a 35 34 20 47 4d 54 2b 30 30 | 18:25:54 GMT+00 |
77+
| 0040 30 30 20 28 43 6f 6f 72 64 69 6e 61 74 65 64 20 | 00 (Coordinated |
78+
| 0050 55 6e 69 76 65 72 73 61 6c 20 54 69 6d 65 29 | Universal Time) |
79+
80+
This is one request taken from the PCAP file which intercepted a message from the Server to the Client sending the current date. The payload is send in hexadecimal format. In the Info tab, you can see the request is being sent from port 8080 (Server) to port 60137 (generated port for given Client).

0 commit comments

Comments
 (0)