Download presentation
Presentation is loading. Please wait.
Published byDonna Curlin Modified over 9 years ago
1
Taekyung Kim 0x410 ~ 0x430 2014. 11. 20
2
2
3
3 International Standards Organization (ISO) is a multinational body dedicated to worldwide agreement on international standards. –Almost three-fourths of countries in the world are represented in the ISO. An ISO standard that covers all aspects of network communications is the Open Systems Interconnection (OSI) model. –It was first introduced in the late 1970s. The OSI model is a layered framework for the design of network systems that allows communication between all types of computer systems
4
4 Physical: transmit bits over a medium Data link: organize bits into a frame Network: move packets from source to destination Transport: provide reliable process-to-process message delivery Session: establish, manage, and terminate sessions Presentation: translate, encrypt and compress data Application: allow access to the network resources
5
5 Encapsulation
6
6 Message Propagation Client Server Router ARouter B
7
7 The physical layer consists of the basic networking hardware transmission technologies of a network The bit stream may be grouped into code words or symbols and converted to a physical signal that is transmitted over a hardware transmission medium
8
8 The data link layer is the protocol layer that transfers data between nodes on the same LAN segment Data link layer services –Encapsulation of network layer data packets into frames –Frame synchronization –Logic link control sublayer Error control (ARQ) Flow control –Media access control (MAC) sublayer Multiple access protocols for channel-access control (e.g. CSMA/CD, CSMA/CA) Physical addressing (MAC addressing) LAN switching (packet switching) Data packet queuing or scheduling
9
9 Address Resolution Protocol (ARP) –is used to convert an IP address to a MAC address
10
10 The network layer is responsible for packet forwarding including routing through intermediate routers Protocols –IPv4 / IPv6: Internet Protocol –ICMP: Internet Control Message Protocol –ARP: Address Resolution Protocol –IGMP: Internet Group Management Protocol –PIM-SM: Protocol Independent Multicast Sparse Mode –PIM-DM: Protocol Independent Multicast Dense Mode –RIP: Routing Information Protocol
11
11 IPv4 Header Format
12
12 IPv4 Fragmentation –Separated into MTU (maximum transmission unit) size
13
13 Internet Control Message Protocol (ICMP) –is used by network devices, like routers, to send error message indicating for example a requested service is not available or a host or router could not be reached –is assigned protocol number 1 But it is still network layer protocol
14
14 Internet Control Message Protocol (Cont’d) –Ping operates by sending ICMP echo request packets to the target host and waiting for an ICMP echo response –Traceroute
15
15 A transport layer provides end-to-end communication services for applications Transport layer services –Same order delivery Segment numbering –Reliability ACK message –Flow control –Congestion avoidance –Multiplexing Ports
16
16 TCP Header Format
17
17 TCP Three Way Handshaking
18
18 TCP Congestion Control
19
19
20
20 A socket is an endpoint of an inter-process communication flow across a computer network –A socket address is the combination of an IP address and a port number (src_ip, src_port, dst_ip, dst_port) –Based on this address, sockets deliver incoming data packets to the appropriate application process or thread
21
21 Header files – Core Berkely Software Distribution (BSD) socket functions and data structures – AF_INET and AF_INET6 address families – Functions for manipulating numeric IP addresses – Functions for translating protocol names and host names into numeric addresses
22
22 socket(int domain, int type, int protocol) –creates a new socket of a certain socket type and allocates system resources to it connect(int fd, struct sockaddr *remote_host, socklen_t addr_length) –is used on the client side, and assigns a free local port number to a socket –attempts to establish a new TCP connection bind(int fd, struct sockaddr *remote_host, socklen_t addr_length) –is used on the server side, and associates a socket with a socket address structure
23
23 listen(int fd, int backlog_queue_size) –is used on the server side, and causes a bound TCP socket to enter listening state –store requests into a backlog queue accept(int fd, struct sockaddr *remote_host, socklen_t *addr_length) –is used on the server side –accepts a received incoming attempt to create a new TCP connection from the remote client send(), recv(), write(), read(), sendto(), recvfrom() –are used for sending and receiving data to/from a remote host
24
24 socket(int domain, int type, int protocol) –Domain AF_INET: IPv4 AF_INET6: IPv6 –Type SOCK_STREAM: reliable stream SOCK_DGRAM: datagram service SOCK_RAW: raw protocols –Protocol IPPROTO_TCP, IPPROTO_UDP, IPPROTO_RAW, and so on The value ‘0’ is used to select a default protocol from the selected domain and type
25
25 AF_INET v.s. PF_INET –At socket.h /* Protocol families. */ #define PF_INET 2 /* IP protocol family. */ /* Address families. */ #define AF_INET PF_INET –The current POSIX.1-2008 specification doesn’t specify any of PF_-constants, but only AF_- constants
26
26 htonl(), htons(), ntohl(), ntohs() –convert values between host and network byte order –On the i386 the host byte order is LSB first, whereas the network byte order is MSB first
27
27 inet_aton(), inet_ntoa() –Internet address manipulation routines –inet_aton() converts the Internet host address, given in IPv4 dotted notation, to a network bytes –inet_ntoa() converts the Internet host address, given in network byte order, to a string in IPv4 dotted notation
28
28 Create a socket –SO_REUSEADDR option the socket can be successfully bound unless there is a conflict with another socket bound to exactly the same combination of source address and port Specify the address
29
29 Bind the socket Accept a connection and print received bytes
30
30
31
31 Well-known ports –The port numbers in the range from 0 to 1023 are the well-known ports –They are used by system processes that provide widely used types of network services –Example 20: ftp-data 21: ftp-command 22: ssh 23: telnet 80: http 443: https
32
32 HTTP HEAD Command
33
33 gethostbyname(const char *name) –returns a structure of type hostent for the given host name –name can be either a hostname or an IPv4 address in dot notation or IPv6 address in colon notation
34
34
35
35 Get webserver id by using a HTTP HEAD command Get host address Send a HTTP GET command and filter received data
36
36
37
37 Handle HTTP GET and HTTP HEAD command Open a socket with an 80 (HTTP) port
38
38 handle_connection()
39
39 handle_connection() (Cont’d)
40
40./webserver_id localhost
41
41 Web Browser Test
42
42
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.