Elementary Name and Address Conversions

Slides:



Advertisements
Similar presentations
Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Advertisements

Chapter 10 IPv4 and IPv6 Interoperability. contents Introduction IPv4 Client, IPv6 Server IPv6 Client, IPv4 Server IPv6 Address Testing Macros IPV6_ADDRFORM.
Topics: –DNS system –Gathering machine information How to find out the machines ip address, name, OS, version, etc.
Sockets: Network IPC Internet Socket UNIX Domain Socket.
I/O Models Satish Krishnan. I/O Models Blocking I/O Non-blocking I/O I/O Multiplexing Signal driven I/O Asynchronous I/O.
Today’s topic: Basic TCP API –Socket –Bind –Listen –Connect –Accept –Read –Write –Close.
Data Communications and Networking (Third Edition)
CS3516 (B10) HELP Session 2 Presented by Lei Cao.
Lecture 10 Doman Name System CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger and Kurose & Ross.
Name and Address Conversions© Dr. Ayman Abdel-Hamid, CS4254 Spring CS4254 Computer Network Architecture and Programming Dr. Ayman A. Abdel-Hamid.
Socket Programming: a Primer Socket to me!. Feb. 23, 2001EE122, UCB2 Why does one need sockets? application network protocol sockets network.
Client Design. Issues Server Identification Setting up a socket on client side TCP –Reading and writing with a socket –Closing a socket UDP –Reading and.
Tutorial 8 Socket Programming
CS4514 B05 HELP Session 1 CS4514 – TCP/IP Socket Programming Presented by Feng Li
CS 311 – Lecture 19 Outline Internet Sockets – gethostname utility – struct hostent – inet_addr – Machine byte to Network byte order translation and vice.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Introduction to Socket Programming April What is a socket? An interface between application and network –The application creates a socket –The socket.
SOCKETS Lecture #3. The Socket Interface Funded by ARPA (Advanced Research Projects Agency) in Developed at UC Berkeley Objective: to transport.
1 Advanced Name and Address Conversions getaddrinfo, getnameinfo, gai_strerror, freeaddrinfo host_serv, tcp_connect, tcp_listen, udp_client, udp_connect,
Introduction to Project 1 Web Client and Server Jan 2006.
CS640: Computer Networks Aditya Akella Lecture 17 Naming and the DNS.
Network Programming Sockets and Winsock. Please Be Responsible We all know that the Internet is full of security holes –most of them do not require any.
Babak Esfandiari (based on slides by Qusay Mahmoud)
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
Operating Systems Chapter 9 Distributed Communication.
Netprog: DNS and name lookups1 Address Conversion Functions and The Domain Name System Refs: Chapter 9 RFC 1034 RFC 1035.
Lecture on DHCP, DNS & SNMPDebashis Saha Thursday, May 17, DHCP, DNS, SNMP Debashis Saha MIS Group, IIM Calcutta
Computer Networks Mozafar Bag-Mohammadi Lecture 5 Naming and the DNS.
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
IT1352-NETWORK PROGRAMMING AND MANAGEMENT
Elementary Name and Address Conversions
CSTP FS01CS423 (cotter)1 Protocols 2 References: RFC’s 791, 793, 768, 826.
1 CMPT 471 Networking II Transport Layer Network Programming © Janice Regan, 2013.
Netprog: DNS and name lookups1 Address Conversion Functions and The Domain Name System Refs: Chapter 9 RFC 1034 RFC 1035.
The Application Layer Application Services (Telnet, FTP, , WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery Service (IP) Unreliable.
Socket 实验汇总 1. 2 Lab1( 需验收 ) Run all the sample programs today and answer the mentioned questions. Learn about the O_APPEND flag used in open(). Question:
TELE202 Lecture 15 Socket programming 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (2) »Source: chapter 17 ¥This Lecture »Socket programming.
Socket Programming Lab 1 1CS Computer Networks.
TELE 402 Lecture 6: Name and address conversions 1 Overview Last Lecture –Socket Options and elementary UDP sockets This Lecture –Name and address conversions.
Sockets Socket = abstraction of the port concept: –Application programs request that the operating system create a socket when one is needed –O.S. returns.
Advanced UNIX programming Fall 2002 Instructor: Ashok Srinivasan Lecture 25 Acknowledgements: The syllabus and power point presentations are modified versions.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
1 CS716 Advanced Computer Networks By A. Wahid Shaikh.
Socket address structures Byte ordering IP address conversion
Sockets Introduction Socket address structures Value-result arguments
Concurrent Servers. Idea Behind Concurrent Servers Server Client 1 Server 1 X.
1 Network Programming. 2 Background Important guidelines –Use conductor.tamucc.edu or any LINUX machine to develop your network applications –Do not use.
In unistd.h : int gethostname(char * name, int maxlen) Purpose : Find the computer's name.
Chapter 11 Advanced Name and Address Conversion. Introduction gethostbyname, gethostbyaddr: protocol dependent getaddrinfo: –a function providing protocol.
EECS340 Recitation 1: Very helpful to your project Hongyu Gao 1.
Socket Programming(1/2). Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
Client-Server model. Socket programming 
Name and Address Conversions
Name/Address conversion:
Socket programming Péter Verhás August 2002
Advanced Computer Networks
Chapter 10 IPv4 and IPv6 Interoperability
Mozafar Bag-Mohammadi Lecture 5 Naming and the DNS
CpSc 360: Distributed and Network Programming
Chapter4 Elementary TCP Socket
Name and Address Conversions Part I
Introduction to Network Programming Speaker: Jae Chung
Things that are nice to know when you’re doing this project
Recitation 11 – 4/29/01 Outline Sockets Interface
Internet and Intranet Protocols and Applications
28.
Network Programming Chapter 12
Socket Programming(1/2)
in unistd.h: int gethostname(char * name, int maxlen)
Today’s topic: Basic TCP API
Presentation transcript:

Elementary Name and Address Conversions Chapter9 Elementary Name and Address Conversions

Introduction Domain Name Server gethostbyname Function. gethostbyaddr Function. uname Function. gethostname Function. getsvrbyname & getsvrbyport Function.

Domain Name System FQDN(Fully qualified domain name) ex) comedu.chungbuk.ac.kr. RRs(Resource Records)

Resolvers and Name Servers Application code Resolver Local name server Other configuration files Function call Function return UDP request UDP reply /etc/resolv.conf Typical arrangement of clients, resolvers, and name servers

gethostbyname Function #include <netdb.h> struct hostent *gethostbyname (const char *hostname); struct hostent { char *h_name; /* official (canonical) name of host */ char **h_aliases; /* pointer to arrayof opinters to alises names */ int h_addrtype; /* host address type : AF_INET or AF_INET6 */ int h_length; /* length of address : 4 or 6 */ char **h_addr_list; /* ptr to array of ptrs with IPv4 or IPv6 addrs */ }; hostent{} h_name h_aliases h_addrtype h_length h_addr_list official hostname \0 NULL Alises #1 \0 Alises #2 \0 IP addr #1 IP addr #2 IP addr #3 h_length =4 In_addr{} AF_INET 4

RES_USE_INET6 Resolver Option 1. #include <resolv.h> res_init(); _res.option |= RES_USE_INET6; 2. export RES_OPTION=inet6; (shell once) (in .profile One User Only) 3. options inet6 (in /etc/resolv.conf) if all program support IPv6

gethostbyname2 Function #include <netdb.h> struct hostent *gethostbyname2 (const char *hostname, int family);

gethostbyaddr Function #include <netdb.h> struct hostent *gethostbyaddr(const chr *addr, size_t len,int family); The field of interest in this structure is normally h_name, the canonical hostname

uname Function gethostname Function #include <netdb.h> int uname(struct utsname *name); #define _UTS_NAMESIZE 16 #define _UTS_NODESIZE 256 struct ntsname { char sysname[_UTS_NAMESIZE]; /* name of this operationg system */ char sysname[_UTS_NAMESIZE]; /* name of this node */ char sysname[_UTS_NAMESIZE]; /* O. S. release level */ char sysname[_UTS_NAMESIZE]; /* O. S. version level */ char sysname[_UTS_NAMESIZE]; /* hardware type */ }; gethostname Function #include <netdb.h> int gethostname(char *name, size_t namelen);

getservbyname Function #include <netdb.h> struct servent *getservbyname(const char *servname, const char *protoname); struct servent { char *s_name; /* official service name */ char **s_ aliases; /* aliases list*/ int s_port; /* port number, network by order */ char *s_proto; /* protocol to use */ }; getservbyport Function #include <netdb.h> struct servent *getservbyport(int port, const char *protoname);