Understand IPv4 Addressing. IPv4: originally Classfull Addressing  Special address  Host ID = 0: network address  Network ID = 0, host ID = 0  i.e.

Slides:



Advertisements
Similar presentations
CS 4700 / CS 5700 Network Fundamentals
Advertisements

Discussion Monday ( ). ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier header checksum time to live.
Programming with UDP – I Covered Subjects: IPv4 Socket Address Structure Byte Ordering Functions Address Access/Conversion Functions Functions: 1.socket()
4: Network Layer4a-1 IP Addressing: introduction r IP address: 32-bit identifier for host, router interface r interface: connection between host, router.
Lecture 5: TCP/IP OSI layers 3 (IP) and 4 (TCP/UDP) IPv4 – addresses and routing, “best-effort” service Ethernet, Appletalk, etc wrap IP packets with their.
Week 5: Internet Protocol Continue to discuss Ethernet and ARP –MTU –Ethernet and ARP packet format IP: Internet Protocol –Datagram format –IPv4 addressing.
The Network Layer Chapter 5. The IP Protocol The IPv4 (Internet Protocol) header.
Chapter 5 The Network Layer.
11- IP Network Layer4-1. Network Layer4-2 The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection.
Tutorial 8 Socket Programming
IP Addressing: introduction
1 Application TCPUDP IPICMPARPRARP Physical network Application TCP/IP Protocol Suite.
Network Layer4-1 Network layer r transport segment from sending to receiving host r on sending side encapsulates segments into datagrams r on rcving side,
Network Layer4-1 Network layer r transport segment from sending to receiving host r on sending side encapsulates segments into datagrams r on rcving side,
IP-UDP-RTP Computer Networking (In Chap 3, 4, 7) 건국대학교 인터넷미디어공학부 임 창 훈.
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
UNIX Sockets COS 461 Precept 1.
Sockets CIS 370 Fall 2009, UMassD. Introduction  Sockets provide a simple programming interface which is consistent for processes on the same machine.
ECE 4110 – Internetwork Programming Client-Server Model.
Sockets and intro to IO multiplexing. Goals We are going to study sockets programming as means to introduce IO multiplexing problem. We will revisit socket.
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
University of Calgary – CPSC 441.  UDP stands for User Datagram Protocol.  A protocol for the Transport Layer in the protocol Stack.  Alternative to.
Sockets CIS 370 Lab 10 UMass Dartmouth. Introduction 4 Sockets provide a simple programming interface which is consistent for processes on the same machine.
© Introduction to Internetworking – Alex Kooijman 04/04/2000 Introduction to internetworking Part Two.
Effective TCP/IP Programming Snader, ETCP 중심으로. Understand IPv4 Addressing.
Chapter 2 Applications and Layered Architectures Sockets.
Network Programming Eddie Aronovich mail:
1 Network Layer Lecture 15 Imran Ahmed University of Management & Technology.
Remote Shell CS230 Project #4 Assigned : Due date :
Advanced TCP/IP Planning and Design Variable Length Subnet Mask (VLSM) Supernetting Classless Enter Domain Routing (CIDR)
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
CS 158A1 1.4 Implementing Network Software Phenomenal success of the Internet: – Computer # connected doubled every year since 1981, now approaching 200.
Advanced Sockets API-II Vinayak Jagtap
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
Network Layer4-1 The Internet Network layer forwarding table Host, router network layer functions: Routing protocols path selection RIP, OSPF, BGP IP protocol.
Page 1 Network Addressing CS.457 Network Design And Management.
UNIX Sockets COS 461 Precept 1. Socket and Process Communication The interface that the OS provides to its networking subsystem application layer transport.
Network Layer4-1 Datagram networks r no call setup at network layer r routers: no state about end-to-end connections m no network-level concept of “connection”
Client/Server Socket Programming Project
IP addresses IPv4 and IPv6. IP addresses (IP=Internet Protocol) Each computer connected to the Internet must have a unique IP address.
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.
Chapter 4 Network Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these.
The Internet Network layer
Data Communications and Computer Networks Chapter 4 CS 3830 Lecture 19 Omar Meqdadi Department of Computer Science and Software Engineering University.
1 Spring Semester 2008, Dept. of Computer Science, Technion Internet Networking recitation #7 Socket Programming.
1 ioctl Function ioctl function get_ifi_info function ARP cache operations: eg. Print H/W addresses.
Network Layer4-1 Chapter 4: Network Layer Chapter goals: r understand principles behind network layer services: m network layer service models m forwarding.
Introduction to Internetworking. 2 The IP Addressing Scheme (IPv4) (psu.edu) Dotted Decimal Notation: A notation more convenient for humans.
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.
Introduction to Networks
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
UNIX Sockets COS 461 Precept 1.
Internet technologies
Socket Programming in C
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Unit 2: IP addressing (Contd.). Delivery and routing of packets
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Wide Area Networks and Internet CT1403
Transport Protocols An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Chapter 06. UDP Server/Client.
Socket Programming(1/2)
46 to 1500 bytes TYPE CODE CHECKSUM IDENTIFIER SEQUENCE NUMBER OPTIONAL DATA ICMP Echo message.
Socket Programming Neil Tang 09/08/2008
Internet Networking recitation #8
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Presentation transcript:

Understand IPv4 Addressing

IPv4: originally Classfull Addressing  Special address  Host ID = 0: network address  Network ID = 0, host ID = 0  i.e means this network  127.x.y.z : “looped back”  Host ID = all 1s : broadcasting  NAT address  10/8  /12  /12  Broadcast address   Limited broadcast  router 밖에는 나가지 못함   Network-directed broadcast  그 네트워크까지 가서 네트워크 내에 broadcast  /24  Subnet-directed broadcast  /24 subnet 내에 broadcast IPv4 address 는 host 의 address 가 아니라 interface 의 address 이다.

Subnet  Network address  IP address && mask  Network ID network consisting of 3 subnets subnet / / / /16 CIDR (Classless Inter-Domain Routing)  Subnetting + suppernetting

Tip: Develop and Use Application “Skeletons”

Simple TCP Client and Server Client: simplec.c Server: simples.c

Making UNIX/Windows Compatible UNIX: bsd/skel.hWindows: win/skel.h wincompat.c: Window 에서 socket 을 생성전에 call 해야

TCP Server Skeleton tcpserver.skel: “mclab.hufs.ac.kr” or “ ” or “” -- server “http” or “80”

TCP Server Skeleton - Cont’d Usage: % myserver [local_addr | local_name] {local_port | service} Example: %myserver %myserver localhost http

TCP Client Skeleton tcpclient.skel: Usage: % myclient {peer_addr | peer_name} {peer_port | service} Example: % myclient % myclient http

UDP Server & Client Skeleton udpserver.skel:udpclient.skel:

Build Your Own Library and Use It ! etcp.h

TCP Client & Server Starting Functions Host name or IP addr or “” (my addr for server) “http” or “80”

UDP Client & Server Starting Functions

Remember that TCP is a Stream Protocol

TCP is a Stream Protocol  No message boundary, just a byte stream  TCP application 에서 하나의 message 를 send() 했다고 해서 recevier application 에서 그 message 를 한 덩어리로 recv() 되는 것이 아니다.  Message 를 send() 했어도 TCP segment 에 언제, 어떻게 실릴지 모른다. (buffering 되기 때문 )  Recv() 하면 몇 byte 읽힐지 모른다.  If you want to read exactly n bytes ??  If you want to make a record ???  Use end-of-record mark. e.g) new line  Handle variable records (using fixed header) #include /* UNIX */ #include /* Windows */ int recv (SOCKET s, void *buf, size_t bufsize, int flags); int read (SOCKET s, void *buf, size_t bufsize);/* UNIX */ Returns: # of bytes read (>0), 0 if received FIN and no more data, -1 on failure int send (SOCKET s, const void *buf, size_t len, int flags); int write (SOCKET s, const void *buf, size_t len);/* UNIX */ Returns: # of bytes transferred on success, -1 on failure 메시지를 읽을 user buffer 의 크기 즉, 최대로 읽을 수 있는 크기 Socket send buffer 에 저장할 메시지 길이

Use End-of-record mark: read a line lib/readline.c:

Read n bytes and Read a variable-length record Record Length Other Header Data Variable Data lib/readn.c: lib/readvrec: #include “etcp.h” int readn (SOCKET s, char *buf, size_t len); Returns: # of bytes read, -1 on failure int readvrec (SOCKET s, char *buf, size_t len); Returns: # of bytes read, -1 on failure len cnt bp Header size Network byte order

Example: Client/Server using variable records vrc.c: vrs.c: