Скачать презентацию
Идет загрузка презентации. Пожалуйста, подождите
Презентация была опубликована 11 лет назад пользователемВладлена Кадомцева
1 Transport Protocols
2 Transport Layer
3 Port Numbers UDP (and TCP) use port numbers to identify applications A globally unique address at the transport layer (for both UDP and TCP) is
4 Unique input/output designations for an application protocol There are 65,535 ports per host RFC1700: - The Well Known Ports (0-1023) are controlled and assigned by the IANA and on most systems can only be used by system (or root) processes or by programs executed by privileged users - Registered nort numbers ( ) Client: The Dynamic and/or Private Ports (49152 – 65535) Port Numbers (2)
5 Services and Ports: ~]$ less/etc/services ….. ftp 21/tcp ssh 22/tcp # SSH Remote Login Protocol telnet 23/tcp smtp 25/tcp mail time 37/tcp timserver time 37/udp timserver domain 53/tcp # name-domain server domain 53/udp bootps 67/tcp # BOOTP server bootpc 68/tcp # BOOTP client http 80/tcp www www-http # WorldWideWeb HTTP netbios-dgm 138/udp netbios-ssn 139/tcp # NETBIOS session service imap 143/tcp imap2 # Interim Mail Access Proto v2 pop3s 995/tcp # POP-3 over SSL syslog 514/udp socks 1080/tcp # socks proxy server wins 1512/tcp # Microsoft's Windows Internet # Name Service wins 1512/udp # Microsoft's Windows Internet mysql 3306/tcp # MySQL ……
6 Protocol Ports For two processes to communicate, they must be able to address one another To identify a process both UDP and TCP use an abstraction called a protocol port Connection = IP-addr1:Port1 + IP-addr2:Port2 Pair IP-addr:Port is identified socket TCP End Points Connections Port 1143 Port 21, ftp server Port 1569 Port 2345 TCP
7 Sockets The socket interface is one of several application programming interfaces (APIs) to the communication protocols. A socket is a special type of file handle, which is used by a process to request network services from the operating system. A socket is a programming level abstraction which points to an Internet end point
8 Оператор формирования сокета имеет вид: s=socket(INT AF, INT type, INT protocol); -AF (address_family) - набор протоколов, соответствующий данному сокету. Example: Internet: PF_INET, Local_unix: PF_UNIX. -type определяет тип коммуникаций Example: SOCK_STREAM, SOCK_RAW, и SOCK_DGRAM. -protocol задает код конкретного протокола из указанного набора (заданного AF), который будет реализован в данном соединении. Ехаmрlе: IPPROTO_TCP, IPPROTO_UDP. Допускается значение protocol=0 (протокол не указан), в этом случае используется значение по умолчанию для данного вида соединений. Значения AF и type можно найти в файле Возвращаемый параметр S - дескриптор сокета. Socket creation Linux API
9 Berkeley Sockets ServerClient socket() bind() listen() accept() read()/write() recv()/send() socket() connect() write() read() close() TCP ServerClient socket() bind() socket() sendto() recvfrom() close() UDP recvfrom() sendto() bind()
10 Example:Existing Services ~]$ netstat -an Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp : :* LISTEN tcp : :* LISTEN tcp : :* LISTEN tcp : :* LISTEN tcp : :* LISTEN tcp : :* LISTEN tcp : :4090 ESTABLISHED tcp : :4870 ESTABLISHED tcp : :1215 ESTABLISHED tcp : :443 ESTABLISHED tcp : :42590 TIME_WAIT udp : :* udp : :*
11 Transport Layer UDP (User Datagram Protocol ) RFC 768
12 UDP in TCP/IP Stack Media Access Control (Ethernet, Token Ring, FDDI, X.25, PPP, etc.) User Datagram Protocol (UDP) RFC 768 ~ connectionless transport ~ Transmission Control Protocol (TCP) RFC 793 ~ connection-oriented transport ~ Upper-Layer Protocols ~ such as SNMP, telnet, FTP, HTTP, POP3, etc. ~ Upper Transport Network Data Link ARP Internet Control Messaging Protocol (ICMP) RFC 792 Internet Protocol version 4 (IPv4) RFC 791 RARP
13 User Datagram Protocol (UDP) Unreliable and unordered datagram service Adds multiplexing No flow control Endpoints identified by ports –servers have well-known ports (see file services) Header format: Pseudo-IP Header: Optional checksum –psuedo header + UDP header + data
14 UDP Checksum at Sender Add pseudo-header Fill checksum with 0s Divide into 16-bit words (adding padding if required) Add words using 1s complement arithmetic Complement the result and put in checksum field Drop pseudo-header and padding Deliver UDP segment to IP source port #dest port # 32 bits data (add padding to make data a multiple of 16 bits) length checksum 32-bit source IP address 32-bit destination IP address length protocol 0s The pseudo-header
15 Binary Checksum Example Carry from 1 st column Carry from 2 nd column Carry from 3 rd column Carry from 4 th column Carry from 5 th column Carry from 13 th column Carry from 12 th column Carry from 16 th column
16 Checksum calculation at Receiver Add pseudo-header to the UDP segment Divide into 16-bit words and add words using 1s complement arithmetic Complement result If result is all 0s –Drop pseudo-header and padding (if any) –Accept segment Else drop segment
Еще похожие презентации в нашем архиве:
© 2024 MyShared Inc.
All rights reserved.