Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab 1 Introduction MMLAB. Environment Install Linux OS in a computer( VirtualBox or Vmware or Native) It’s all up to you for selecting Ubuntu Server or.

Similar presentations


Presentation on theme: "Lab 1 Introduction MMLAB. Environment Install Linux OS in a computer( VirtualBox or Vmware or Native) It’s all up to you for selecting Ubuntu Server or."— Presentation transcript:

1 Lab 1 Introduction MMLAB

2 Environment Install Linux OS in a computer( VirtualBox or Vmware or Native) It’s all up to you for selecting Ubuntu Server or Ubuntu Desktop Or using winsock for socket programming on your Windows Platform

3 Socket programming

4 Socket These two process could be different computer(or the same) Using IP + port + protocol to describe a communication

5 OSI model socket

6 TCP Transmission Control Protocol Reliable(Three-way handshake) In-order Retransmission Deprecate duplicated packets congestion control/ flow control

7 Three-way handshake

8 Retransmission

9 Congestion Control

10 TCP flow Establish socket Bind address and socket Designate socket Waiting client… Read socket Write socket Close socket

11 Using System Call socket(AF_INET, SOCK_STREAM, 0) AF_INET : address family, ipv4 SOCK_STREAM : connection type, for TCP(SOCK_DGRAM for UDP) Return type : int bind(sockfd, (struct sockaddr*)& server_addr, sizeof(server_addr)) sockfd : socket descriptor server_addr server_addr size

12 Using System Call listen( sockfd, 5) sockfd : socket descriptor At most 5 connecitons accept(sockfd, (struct sockaddr*)&cli_addr, &clien) sockfd : socket descriptor cli_addr: client address clien: length of client connect(sockfd, (struct *sockaddr)&serv_addr, &serv) sockfd : socket descriptor serv: length of server

13

14 UDP User Datagram Protocol Unreliable and more fast no guarantee of transferring data bits or packets in an arranged manner

15 UDP Flow (connectionless)

16 socket bind Listen & accept read write socket connect write read

17 TCP demo np/tcp/echo_once/server.c gcc –o server server.c./server.c 5566 np/tcp/echo_once/client.c gcc –o client client.c./client.c localhost 5566

18 UDP demo np/udp/echo/server.c gcc –o server server.c./server np/udp/echo/client.c gcc –o client client.c./client

19 UDP File Transfer: TFTP(1/6) 提出寫入要求

20 UDP File Transfer: TFTP(2/6) ACK

21 UDP File Transfer: TFTP(3/6) 寫入有編號的 data

22 UDP File Transfer: TFTP(4/6) ACK 收到的編號

23 UDP File Transfer: TFTP(5/6) 如果有 packet 沒 收到,重送

24 UDP File Transfer: TFTP(6/6) 回 ACK

25 輸入為以下形式 執行檔需有 5 個參數 依序為 tcp 或 udp, 傳送端或接收端, port, host, 傳送檔案路徑 $./lab2_file_transfer tcp send test_input.txt $./lab2_file_transfer tcp recv $./lab2_file_transfer udp send test_input.txt $./lab2_file_transfer udp recv

26 報告內容包含 傳送 Log, 每 5% 記錄一筆,需要紀錄傳送進度和時間 UDP 版本的 Packet Loss Rate 簡述 UDP 和 TCP 的差異在 200 字以內 200 字的心得

27 Lab1 要求 1-to-1 UDP 和 TCP 版本 File Transfer 的功能 程式可以傳送也可以接收資料 ( 可從 input 控制是要傳還是要送 ) 能傳送 1MB, 10MB, 100MB 的測資,且不能把東西送壞掉 紀錄下傳送的 LOG 每 5% 記錄一筆 例如 5% 2015/03/17 12:00:20 10% 2015/03/17 12:02:32 UDP 版本需記錄下 Packet Loss Rate ( 遺失封包 / 總傳送封包 x 100%) 心得 200 字

28 Lab1 作業繳交資訊 Moodle 上傳作業 報告請用 PDF 檔, code 請用.c 或.cpp 檔,總共需要上傳兩個檔案 將兩個檔案壓縮, 檔名用自己的學號加上編號命名 例如 P76031292_lab2_v1.zip DUE : 2016. 3. 22( 二 ) 23:59 TA mail :suwl@locust.csie.ncku.edu.tw


Download ppt "Lab 1 Introduction MMLAB. Environment Install Linux OS in a computer( VirtualBox or Vmware or Native) It’s all up to you for selecting Ubuntu Server or."

Similar presentations


Ads by Google