TCP-over-UDP Cheng-Han Lee (cl2804).

Slides:



Advertisements
Similar presentations
Network Programming Week #1 J.P. Yoo
Advertisements

Socket Programming Computer Networks, Spring 2008 Your TAs.
Echo server The client reads a line of text from its standard input and writes the line to the server The server reads the line from its network input.
Florida State UniversityCOP Advanced Unix Programming Raw Sockets Datalink Access Chapters 25, 26.
Socket Programming 101 Vivek Ramachandran.
Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Socket Programming CS3320 Fall 2010.
Socket programming Socket programming.
Yunhong Gu & Robert Grossman University of Illinois at Chicago
Pål Halvorsen (adapted from lectures by Carsten Griwodz & Olav Lysne) Data Communication: Introduction to Berkeley Sockets INF1060: Introduction to Operating.
Pål Halvorsen (adapted from lectures by Carsten Griwodz & Olav Lysne)
Sockets Programming Network API Socket Structures Socket Functions
Socket Programming. Basics Socket is an interface between application and network – Application creates a socket – Socket type dictates the style of communication.
CS 4700 / CS 5700 Network Fundamentals
Computer Net Lab/Praktikum Datenverarbeitung 2 1 Overview Sockets Sockets in C Sockets in Delphi.
Introduction 1-1 Chapter 3 Transport Layer Intro and Multiplexing Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley.
MERANCANG Program Transfer File (PTF) PTFServer dan PTFClient I Made Astawa
IPv6 Technologies and Advanced Services page 1 Porting applications to IPv6 OpenH323 and IPv6 support K. Stamos Computer Engineer, University of Patras.
Chapter 10 IPv4 and IPv6 Interoperability. contents Introduction IPv4 Client, IPv6 Server IPv6 Client, IPv4 Server IPv6 Address Testing Macros IPV6_ADDRFORM.
Ipv4 Socket Address Structure struct in_addr { in_addr_t s_addr; /* 32-bit IPv4 address */ /* network byte ordered */ }; struct sockaddr_in { uint8_t sin_len;
CSE 333 – SECTION 8 Networking and sockets. Overview Network Sockets IP addresses and IP address structures in C/C++ DNS – Resolving DNS names Demos.
Taekyung Kim 0x410 ~ 0x International Standards Organization (ISO) is a multinational body dedicated to worldwide agreement on international.
Programming with UDP – I Covered Subjects: IPv4 Socket Address Structure Byte Ordering Functions Address Access/Conversion Functions Functions: 1.socket()
CS252: Systems Programming Ninghui Li Based on slides by Prof. Gustavo Rodriguez-Rivera Topic 16: Socket Programming & Project 5.
Lab tutorial Lab assignment 2 Fall 2006
UDP and Multi-thread Socket Programming
Jieun Song Port-Binding & Connect-Back Shellcode.
Quick Overview. 2 ISO/OSI Reference Model Application Application Presentation Presentation Session Session Transport Transport Network Network Data Link.
Sockets Basics Conectionless Protocol. Today IPC Sockets Basic functions Handed code Q & A.
CS 311 – Lecture 18 Outline IPC via Sockets – Server side socket() bind() accept() listen() – Client side connect() Lecture 181CS Operating Systems.
Introduction to Socket Programming April What is a socket? An interface between application and network –The application creates a socket –The socket.
The Basics of communication LectureII. Processing Techniques.
Introduction to Project 1 Web Client and Server Jan 2006.
Introduction to Linux Network 劉德懿
Socket Programming Based on tutorial prepared by EUISOK CHUNG CS3320 Spring2008.
Fall 2000Datacom 11 Socket Programming Review Examples: Client and Server-Diagnostics UDP versus TCP Echo.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
Server Sockets: A server socket listens on a given port Many different clients may be connecting to that port Ideally, you would like a separate file descriptor.
Remote Shell CS230 Project #4 Assigned : Due date :
Socket Programming Lec 2 Rishi Kant. Review of Socket programming Decide which type of socket – stream or datagram. Based on type create socket using.
1 COMP445 Fall 2006 Lab assignment 1. 2 STEP1: Get the name of the second party STEP2: Get phone number from white pages CALLERRECEIVER STEP1: Plug the.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Introduction to Socket
Socket Programming Lab 1 1CS Computer Networks.
Programming with UDP – II Covered Subjects: Creating UDP sockets Client Server Sending data Receiving data Connected mode.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
1 TCP Sockets Programming Creating a passive mode (server) socket.Creating a passive mode (server) socket. Establishing an application-level connection.Establishing.
EECS340 Recitation 1: Very helpful to your project Hongyu Gao 1.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Socket Programming in C CS587x Lecture 3 Department of Computer Science Iowa State University.
1 K. Salah Application Layer Module K. Salah Network layer duties.
1 Socket Interface. 2 Client-Server Architecture The client is the one who speaks first Typical client-server situations  Client and server on the same.
Socket Programming(1/2). Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Jim Fawcett CSE 681 – Software Modeling & Analysis Fall 2002
Class A Addresses The 1st bit of a class A address is 0
Chapter4 Elementary TCP Socket
Review: TCP Client-Server Interaction
Transport layer API: Socket Programming
TCP Sockets Programming
TA: Donghyun (David) Kim
Chapter 06. UDP Server/Client.
Socket Programming(1/2)
46 to 1500 bytes TYPE CODE CHECKSUM IDENTIFIER SEQUENCE NUMBER OPTIONAL DATA ICMP Echo message.
Presentation transcript:

TCP-over-UDP Cheng-Han Lee (cl2804)

Outline ToU APIs Simulation Architecture Using of ToU: Sample code Environmental Setup Test Results Architecture ToU Modules Processtou Thread/ Timer thread (fired pkt & dup ACKs rexmit) Congestion FSM(TCP Reno)/ Processtou FSM/ Delayed ACK FSM Logging mechanisms Closure (close func.) and Connection control Demo (Vmware)

ToU APIs Just like C/C++ Socket Sample Codes Client Server Server Mode Initialize ToU Client Mode Initialize ToU touSocket() Just like C/C++ Socket Sample Codes Client Server touSocket() touBind() touBind() touListen() touConnect() touAccept() touRecv() run() touSend() run() touClose() touClose()

#include "tou. h" #include <sys/socket. h> #include <netdb #include "tou.h" #include <sys/socket.h> #include <netdb.h> using namespace std; /* … main … */ touMain tm; /* fill in the socket struct with server's info */ memset(&socket_svr, NULL, sizeof(socket_svr)); assign_addr(&socket_svr, AF_INET, SVR_IP, SVR_PORT); /* fill in client socket info */ memset(&socket_cli, NULL,sizeof(socket_cli)); socket_cli.sin_family = AF_INET; socket_cli.sin_addr.s_addr = INADDR_ANY; socket_cli.sin_port = htons(CLI_PORT); /* grab client socket */ sockd = tm.touSocket(AF_INET,SOCK_TOU,0); /* bind the socket wiht port number */ tm.touBind(sockd,(struct sockaddr*) &socket_cli,sizeof(socket_cli)); /* connect to port on server */ tm.touConnect(sockd,(struct sockaddr_in*)&socket_svr,sizeof(socket_svr)); ... read data to send_data with size of read_sz */ /* send a message to the server PORT */ while(true){ FD_ZERO(&socks); FD_SET(sockd, &socks); tim.tv_sec = TIMEOUTVAL; tim.tv_usec = 0; if(!indata.eof() && tm.getCirSndBuf() > MORE_BUF)) { indata.read(send_data, MORE_BUF); readsize = indata.gcount(); sendsize = tm.touSend(sockd,send_data, readsize ,0); total_sendsize += sendsize; } selectval = select(sockd+1, &socks, NULL, NULL, &tim); if (selectval){ tm.run(sockd); }else { break; if (totalsendsize < readsize) { }// while(true) cout << "Exit!" << endl; tm.touClose(sockd); Client Side

#include "tou. h" #include <sys/socket. h> #include <netdb #include "tou.h" #include <sys/socket.h> #include <netdb.h> using namespace std; /* … main … */ touMain tm; /* Set socket structures */ memset(&socket_svr, 0, sizeof(socket_svr)); socket_svr.sin_family = AF_INET; socket_svr.sin_addr.s_addr = INADDR_ANY; socket_svr.sin_port = htons(SVR_PORT); memset(&socket_cli, 0, sizeof(socket_cli)); sockd = tm.touSocket(AF_INET,SOCK_TOU,0); tm.touBind(sockd,(struct sockaddr*) &socket_svr,sizeof(socket_svr)); tm.touListen(sockd,1); socklen_t sinlen = sizeof(socket_cli); tm.run(sockd); tm.touAccept(sockd,(struct sockaddr_in*)&socket_cli,&sinlen); while(true){ FD_ZERO(&socks); FD_SET(sockd, &socks); tim.tv_sec = TIMEOUTVAL; if (select(sockd+1, &socks, NULL, NULL, &tim)){ tm.run(sockd); //RECV: touRecv data memset(recv_data, 0, sizeof(recv_data)); tm.touRecv(sockd,recv_data,MAXSNDBUF,0); }else{ break; } }// while(true) cout << "Exit!" << endl; tm.touClose(sockd); Server Side

Outline ToU APIs Simulation Architecture Using of ToU: Sample code Environmental Setup Test Results Architecture ToU Modules Processtou Thread/ Timer thread (fired pkt & dup ACKs rexmit) Congestion FSM(TCP Reno)/ Processtou FSM/ Delayed ACK FSM Logging mechanisms Closure (close func.) and Connection control Demo (Vmware)

Environmental Setup Using physical machines rather than vmware to make sure the simulations are close to real cases. Hardware setting of client, server, and router ASUS m5200a D-Link DI-604 Sony NW120J OS: Ubuntu 9.04 2.6.28-19 CPU: Intel Pentium-M 740 MEM:768MB OS: Ubuntu 9.04 2.6.28-19 CPU: Intel Core2 T6500 MEM:4096MB

Environmental Setup Turn the kernel to TCP Reno. Configure the kernel recv/send buffers. echo "reno" > /proc/sys/net/ipv4/tcp_congestion_control echo "3" > /proc/sys/net/ipv4/tcp_reordering echo "0" > /proc/sys/net/ipv4/tcp_abc echo "0" > /proc/sys/net/ipv4/tcp_dsack echo "0" > /proc/sys/net/ipv4/tcp_sack echo "0" > /proc/sys/net/ipv4/tcp_fack echo "0" > /proc/sys/net/ipv4/tcp_timestamps echo "1" > /proc/sys/net/ipv4/tcp_window_scaling echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save echo "0" > /proc/sys/net/ipv4/tcp_slow_start_after_idle   echo "5000" > /proc/sys/net/core/netdev_max_backlog echo "72800" > /proc/sys/net/core/optmem_max # Socket buffer's size echo "72800" > /proc/sys/net/core/rmem_default echo "4194304" > /proc/sys/net/core/rmem_max echo "72800" > /proc/sys/net/core/wmem_default echo "4194304" > /proc/sys/net/core/wmem_max #Number of pages allowed for queuing. echo "65000 80000 94000" > /proc/sys/net/ipv4/tcp_mem echo "65000 80000 94000" > /proc/sys/net/ipv4/udp_mem   #TCP buffer limits echo "4096 72800 4194304" > /proc/sys/net/ipv4/tcp_rmem echo "4096 72800 4194304" > /proc/sys/net/ipv4/tcp_wmem #Minimal size buffers used by UDP sockets. echo "8192" > /proc/sys/net/ipv4/udp_rmem_min echo "8192" > /proc/sys/net/ipv4/udp_wmem_min

Environmental Setup Connection monitor for TCP. Turn off TSO/GSO. #! /bin/bash ethtool –K ethX tso off ethtool –K ethX gso off ethtool –k ethX Connection monitor for TCP. #! /bin/bash modprobe tcp_probe port=$1 chmod 666 /prob/net/tcpprobe cat /proc/net/tcpprobe > /tmp/tcpprobe.out & TCPPROB=$! Commands for emulating WAN. # Delay 50ms tc qdisc add dev eth0 root netem delay 50ms tc qdisc change dev eth0 root netem delay 100ms 10ms # Loss rate set to 0.1% tc qdisc change dev eth0 root netem loss 0.1% ToU: tou –s \ tou IP test_file -c TCP: ttcp -r -v -p Port > /dev/null \ ttcp –t –v –l 1456 -p Port IP < test_file

Test Results Sending 100MB, loss rate 0%, delay 0ms 100ms 300ms 16.47 real seconds , 6261.39 KB/sec 8.47 real seconds , 11895.53 KB/sec 17.46 real seconds , 5906.35KB/sec 9.70 real seconds , 10386.96 KB/sec 21.07 real seconds , 4894.40 KB/sec 16.62 real seconds , 6058.87 KB/sec

Test Results Sending 30MB, loss rate 1%, delay 0ms 100ms 300ms 12.99 real seconds , 2421.65 KB/sec 8.69 real seconds , 3533.34 KB/sec Avg. cwnd: tou(7.99077)/ ttcp(8.934413) Avg. cwnd: tou(9.539957)/ ttcp(9.615262) Avg. cwnd: tou(9.79832714)/ ttcp(11.6885906) 0ms 302.22 real seconds , 104.087 KB/sec 239.15 real seconds , 128.46 KB/sec 728.58 real seconds , 43.176 KB/sec 674.59 real seconds , 45.54 KB/sec 100ms 300ms

Test Results Sending 100MB, loss rate 0.01%, delay 0ms 100ms 300ms 16.61 real seconds , 6205.39 KB/sec 8.98 real seconds , 11216.41 KB/sec 100MB is about 103124992 bytes. A pkt is about 1460 bytes. There’re about 70000 transmits in total. Since the loss rate is 0.01%, there’re about 7 losses. 0ms 38.08 real seconds , 2707.78 KB/sec 23.75 real seconds , 4239.86 KB/sec 71.02 real seconds , 1451.85 KB/sec 61.39 real seconds , 1640.38 KB/sec 100ms 300ms

Test Results: Summary Delay Loss Rate 0ms 100ms 300ms 0%(100mb) ToU 16.47 real seconds 6261.39 KB/sec 17.46 real seconds 5906.35KB/sec 21.07 real seconds 4894.40 KB/sec TCP 8.47 real seconds 11895.53 KB/sec 9.70 real seconds 10386.96 KB/sec 16.62 real seconds 6058.87 KB/sec 1%(30mb) 12.99 real seconds 2421.65 KB/sec 302.22 real seconds 104.087 KB/sec 728.58 real seconds 43.176 KB/sec 8.69 real seconds 3533.34 KB/sec 239.15 real seconds 128.46 KB/sec 674.59 real seconds 45.54 KB/sec 0.01%(100mb) 16.61 real seconds 6205.39 KB/sec 38.08 real seconds 2707.78 KB/sec 71.02 real seconds 1451.85 KB/sec 8.98 real seconds 11216.41 KB/sec 23.75 real seconds 4239.86 KB/sec 61.39 real seconds 1640.38 KB/sec

Outline ToU APIs Simulation Architecture Using of ToU: Sample code Environmental Setup Test Results Architecture ToU Modules Processtou Thread/ Timer thread (fired pkt & dup ACKs rexmit) Congestion FSM(TCP Reno)/ Processtou FSM/ Delayed ACK FSM Logging mechanisms Closure (close func.) and Connection control Demo (Vmware)

ToU Modules Karn & Partridge Algorithm Threading model Timer thread/ Main thread Adopt TCP Reno as congestion control algorithm Slow Start/ Congestion Avoidance/ Fast Retransmit Fast Recovery Karn & Partridge Algorithm Round-Trip Time Estimates for calculating Retransmission Timeout

ToU Programs wc: 6064 lines 18641 words 155678 total Circular Buffer -rwxrw-rw- 1 w4180 w4180 6356 2011-03-27 23:21 circ_buf.cpp -rwxrw-rw- 1 w4180 w4180 2000 2011-03-03 16:28 circ_buf.h -rwxrw-rw- 1 w4180 w4180 16709 2011-02-04 13:39 processtou.cpp -rwxrw-rw- 1 w4180 w4180 3139 2011-03-31 20:16 processtou.h -rwxrw-rw- 1 w4180 w4180 17573 2011-03-31 15:56 timer.cpp -rwxrw-rw- 1 w4180 w4180 8099 2011-03-31 12:34 timer.h -rwxrw-rw- 1 w4180 w4180 4833 2011-03-20 23:29 timer_mng.cpp -rwxrw-rw- 1 w4180 w4180 4263 2011-03-28 09:06 timer_node.cpp -rwxrw-rw- 1 w4180 w4180 1377 2011-03-10 22:29 timestamp.cpp -rwxrw-rw- 1 w4180 w4180 240 2011-03-03 18:07 timestamp.h -rwxrw-rw- 1 w4180 w4180 284 2010-05-16 15:04 tou_boost.h -rwxrw-rw- 1 w4180 w4180 2535 2011-03-28 11:27 tou_comm.h -rwxrw-rw- 1 w4180 w4180 2152 2011-03-28 09:01 tou_congestion.h -rwxrw-rw- 1 w4180 w4180 1515 2011-03-26 23:23 tou_control_block.h -rwxrw-rw- 1 w4180 w4180 6810 2011-03-27 23:08 tou_sock_table.cpp -rwxrw-rw- 1 w4180 w4180 4614 2011-03-27 22:43 tou_sock_table.h -rwxrw-rw- 1 w4180 w4180 3983 2011-03-26 23:19 tou_ss_ca.cpp -rwxrw-rw- 1 w4180 w4180 13915 2011-03-26 11:05 tou.cpp -rwxrw-rw- 1 w4180 w4180 2445 2011-03-16 08:37 tou.h -rwxrw-rw- 1 w4180 w4180 4900 2010-05-04 23:09 tou_header.cpp -rwxrw-rw- 1 w4180 w4180 2231 2011-03-20 14:24 tou_header.h -rwxrw-rw- 1 w4180 w4180 4415 2011-03-24 09:10 tou_logger.cpp -rwxrw-rw- 1 w4180 w4180 2285 2011-03-12 20:54 tou_logger.h Circular Buffer ToU Process Thread Timer Thread Congestion FSM/ Structs ToU APIs ToU Packets/ Structs ToU Logger

ToU Transmission Models Transmit Receive

ToU Process Thread . Circular Buffer Sequence number head head tail Timer Heap snd_una snd_nxt Sequence number window Window Size

Timer Thread 100ms node_t cmp current time . Timer Heap

ToU Control Block

Congestion FSM(TCP Reno)

Processtou FSM/ Delayed ACK FSM

Demo 30mb file with 1% packet loss & 100ms delay Log file Congestion window, sequence number. Socket tables. Packet Send/Recv. Logs. Timer Logs.

Thank You!

get_snd_sz() pop_snd_q() User Space Application touSend() Timer Thread ToU Process RTT/RTO: add() timer push_snd_q() Circular Buffer (cb_send) Min Heap send udp: get_snd_sz() pop_snd_q() timeout: proc_sndpkt() pkt: sendto() (timerheap) Kernel Space UDP Process

timeout: proc_delack() in-order: put_circbuf() User Space Application touRecv() (ackdeque) (minhp_recv) Deque Circular Buffer Min Heap (cb_recv) timeout: proc_delack() in-order: put_circbuf() out-of-order: push_hprecvbuf() Timer Thread ToU Process ack: sendto() recvfrom() Kernel Space UDP Process

Figure 19. cwnd(packets) vs. sequence number

Test Results: Summary Delay Loss Rate 0ms 100ms 300ms 0%(100mb) ToU 9463.98 KB/ sec 8104.67 KB/sec 6422.19 KB/sec TCP 11895.53 KB/sec 10386.96 KB/sec 6058.87 KB/sec Delay 0ms 100ms 300ms Average cwnd size (ToU/TCP) 7.99077/8.934413 9.539957/ 9.615262 9.798327/ 11.68859