Download presentation
Presentation is loading. Please wait.
1
Peer 2 Peer – First Report Submitted by: Arthur Kiyanovsky sandflee@t2 Elena Zarkhin Selenaz@t2 Ilya Bokshtein stypex@t2
2
Objectves P2P chat application including conference chats Many Clients One Server Registration Connection Client discovery Firewall bypassing Tools: Java, Swing
3
Client Connection Types Direct UDP Direct TCP (if UDP port blocked by firewall) Reverse TCP (if connection initiator is blocked by a firewall but the target is not) Indirect – both clients stay connected to the server and speak through it.
4
PART 1: The Protocol & Algorithms
5
Connection & Conference ID Each connection has a Connection ID Each conference chat has a Conference ID. These IDs allow Client A to talk with client B in 2 different chats. The ID structure is : : : : The serial number is necessary for the possibility of a client starting more than 1 chat in the span of 1 second. The ID of a conference is the connection ID of the first connection in the conference.
6
UDP Reliability UDP Datagram (exp. backoff) UDP_ACK Stop & Wait Exponential backoff
7
Registration 1 st phase (Partial or no Firewall) PROB_ACK(UDP) PROBE(UDP) REGISTER REG_ACK PROBE(TCP)
8
Registration 1 st phase (Full Firewall) PROBE(UDP) REGISTER REG_ACK PROBE(TCP)
9
Registration 2 nd phase Notify Clients of a new client Notify new client of clients CLIENTS_ADDED
10
Connection 1 st phase: Connection method retrieval from server CONNECT CON_ACK
11
Connection 2 nd phase (both UDP/TCP open) JOIN_TALK TEXT_MESSAGE SourceDestination
12
Connection 2 nd phase (one UDP closed dest TCP closed) INIT_CALL JOIN_TALK SourceDestination TEXT_MESSAGE
13
Connection 2 nd phase (dest UDP closed both TCP closed) SourceDestination JOIN_TALK TEXT_MESSAGE CALL_ME
14
Conference Call - Adding a new client Added Adder Already in the Conf. call ADD_CLIENT JOIN_TALK
15
Chat session termination TERMINATE Source Destination\s TERMINATE
16
Client Exit Source All Online Clients CLIENT_EXIT
17
Error 1: Server returned wrong connection method JOIN_TALK SourceDestination CHECK_CLIENT PROBE PROB_ACK CON_ACK JOIN_TALK
18
Error 2: Client name already exists REGISTER ERROR
19
Periodical client probing PROBE(UDP) PROB_ACK(TCP) PROBE(TCP) Every X seconds the server sends probes to all the clients. If the status of a port (open\closed) in a client changes the server updates its database.
20
Client recovery after being blocked by a firewall In case a client doesn ’ t receive probes for 2X seconds because of a firewall it registers to the server again. PROBE(UDP) PROBE(TCP) REGISTER PROBE(UDP) PROBE(TCP)
21
Client recovery after being blocked by a firewall - TCP Windows Firewall BUG MESSAGE
22
Client Recovery after firewall has been removed Since probes are periodically sent to both TCP, UDP ports of the client, if one of these ports is suddenly opened the server will know and will consequentially redirect next chats accordingly.
23
Abnormal Client Termination If both client ports are closed the server waits 3X seconds for the client to register again. If that doesn ’ t happen, the server assumes the client disconnected and notifies all other clients by sending them CLIENT_EXIT messages.
24
Abnormal Client Termination cont. PROBE(UDP) PROBE(TCP) PROBE(UDP) PROBE(TCP) Abnormally terminated client All other clients CLIENT_EXIT
25
Abnormal Server Termination Like in the firewall case, if a client doesn ’ t receive probes for 2X seconds it tries to register at the server again. Since the server is not there, connection will fail. All chats will not let the clients to send messages through them. New chats will not be possible.
26
Server Resurrection The client will try to register every 2X seconds the whole time the server is down. If a new server comes up the clients will find out when they try to register again. All the chats will become accessible. If needed the chats will recreate indirect connections with other clients. The system will continue working normally.
27
Part 2: Modules Incoming Interfaces Outgoing Threads ClientServer Listeners Handlers handlermain talk UDP-5000 TCP-5000 TCP-80 UDP-80 probe ServerClient
28
Server Modules TCP listener thread 80 UDP listener thread 80 Handler thread Probe thread Outgoing interface Incoming interface Outgoing interface
29
Client Modules UDP listener thread 5000 TCP listener thread 5000 Talk Thread Main Thread TCP listener thread 80 Outgoing interface Incoming interface
30
Networking - TCP accept TCP listener handler message TCP interface
31
Networking - UDP UDP listener registry Find interface UDP interface message
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.