Download presentation
Presentation is loading. Please wait.
Published byMarylou George Modified over 9 years ago
1
CS 145A Protocols Netlab.caltech.edu/course
2
Misc. Extension Extension Textbooks Textbooks
3
Project 1 Q&A: Can the tcp client send two packets instead of one? Can the tcp client send two packets instead of one? What happens if the udp client cannot receive my message? What happens if the udp client cannot receive my message? Shall I receive and print the message on the client side? Shall I receive and print the message on the client side? How do you grade my work? How do you grade my work?
4
Project 1 Clients: Clients: Get UDP message 1~3 times get TCP message, then client disconnects get TCP message server udpclient 127.0.0.1 udptest1 udpclient 127.0.0.1 udptest2 udpclient 127.0.0.1 udptest3 date tcpclient 127.0.0.1 clienttimeout 8 date (8 seconds) tcpclient 127.0.0.1 servertimeout 12 date (10 seconds)
5
Project 1 Server (Basic Functions): Server (Basic Functions): Server udpclient 127.0.0.1 udptest1 (see "udptest1") udpclient 127.0.0.1 udptest2 (see "udptest2") udpclient 127.0.0.1 udptest3 (see "udptest3") date tcpclient 127.0.0.1 clienttimeout 8 (see "clienttimeout") date (8) tcpclient 127.0.0.1 servertimeout 12 (See "servertimeout") date (10)
6
Project 1 Server (Advanced Function 1, Multi-connection): Server (Advanced Function 1, Multi-connection): Login.cs: (script3) server Tcpclient logincs tcp3 8 (see “ tcp3 ” ) udpclient login.cs udp (see "udp") Local: (script3) tcpclient login.cs tcp1 8 (see “ tcp1 ” ) tcpclient login.cs tcp2 8 (get refused) udpclient login.cs udp (see "udp")
7
Project 1 Server (Advanced Function 2, 5-connections): Server (Advanced Function 2, 5-connections):
8
Project 1 Multiple Processes: One process for each active TCP connection, one UDP process and one Listening process How to tell the main process when the child processes finish the TCP connection? SIGCHILD (with a handler in the main function)
9
Project 1 Multiple Threads: Similar to Multiple Processes pthread_create
10
Project 1 Single Process: One “ select ” for UDP + TCP Listen + All the active TCP connections Timeout of the “ select ” : Check each connection in the active set returned by “ select ”
11
Protocol
12
Protocol Specification (External services and internal operations) Specification (External services and internal operations) Verification (completeness and correctness) Verification (completeness and correctness) Implementation Implementation Testing Testing
13
Protocol Request For Comments http://www.ietf.org/rfc http://www.ietf.org/rfc http://www.ietf.org/rfc Reference Guide: RFC 1000 Reference Guide: RFC 1000 Keywords: RFC 2119 ( “ Must ” / ” Shall ”, “ should ”, “ may ”… ) Keywords: RFC 2119 ( “ Must ” / ” Shall ”, “ should ”, “ may ”… )
14
Formal Methods State Transition Graph State Transition Graph Petri Net Petri Net Process Algebra Process Algebra …
15
Petri-Net (By Carl Adam Petri at 1962) Structure: Place Place Transition Transition Arc Arc Dynamic element: Token Token
16
Petri-Net
17
Petri-Net
18
Petri-Net
19
Petri-Net
20
Petri-Net
21
Petri-Net
22
Petri-Net
23
Petri-Net Extensions: Weighted Arcs / Multiple Tokens Weighted Arcs / Multiple Tokens Token with different colors Token with different colors Time Petri Net Time Petri Net Random Petri Net Random Petri Net …
24
State Transition Graph
25
Basic (FSM): Possible State Set Possible State Set Possible Input Set Possible Input Set Possible Output (Action) Set* Possible Output (Action) Set* State Transition Set: State Transition Set: {(origin_state, input, output, target_state)} Initial State Set Initial State Set
26
State Transition Graph Extended (EFSM, etc): Variables Variables Timers Timers Non-deterministic behaviors … Non-deterministic behaviors …
27
+ Timer
28
States for TCP Connection
29
Modeling is a bridge.
30
Lab 2
31
Task Design a simple protocol for: Two machines talk with each other; Two machines talk with each other; Either machine is able to establish the conversation. Either machine is able to establish the conversation. During the conversation, if one machine sends some message to the other machine, the other machine displays the message on the screen. During the conversation, if one machine sends some message to the other machine, the other machine displays the message on the screen. If one machine does not want to talk any more (or dies, or is disconnected from the network), the other machine should have a way to know about that. (although maybe after some delay – the delay should be bounded.) If one machine does not want to talk any more (or dies, or is disconnected from the network), the other machine should have a way to know about that. (although maybe after some delay – the delay should be bounded.)
32
Lab 2 Assumptions: We can use TCP (reliable connection) We can use TCP (reliable connection) The TCP may return error when you tries to do socket operations. (not so “ reliable ” !!!) The TCP may return error when you tries to do socket operations. (not so “ reliable ” !!!)
33
Lab 2 Requirements: Read RFC 2119. Read RFC 2119. Use state transition graph to help you design Use state transition graph to help you design Use texts to specify the details (use the key words as defined in RFC 2119) Use texts to specify the details (use the key words as defined in RFC 2119) Think about different scenarios to test your design Think about different scenarios to test your design
34
Lab 2 Grading: Correctness and Completeness (80%) Correctness and Completeness (80%) Feasibility (20%) Feasibility (20%) Due: Nov.1 2002 Submission: As homework submission.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.