* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 21_Networking
Net neutrality law wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Deep packet inspection wikipedia , lookup
Airborne Networking wikipedia , lookup
Computer network wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Communication protocol wikipedia , lookup
Advanced Programming in Java Networking Mehdi Einali 1 agenda Basic Concepts on Networking IP Address Protocol Ports The Client/Server Paradigm Sockets The Java Networking Package The ServerSocket and the Socket Class The MulticastSocket and the DatagramPacket Class 2 Networking 3 Basic Concepts on Networking The Internet A global network of computers connected together in various ways Remains functional despite of diversity of hardware and software connected together Possible through communication standards defined and conformed to Guarantee compatibility and reliability of communication 4 IP Address Logically similar to the traditional mailing address An address uniquely identifies a particular object Each computer connected to the Internet has a unique IP address (Version 4) A 32-bit number used to uniquely identify each computer connected to the Internet 192.1.1.1 docs.rinet.ru(via dns) 4294967296 (232) addresses Pv6 uses a 128-bit address, theoretically allowing 2128, or approximately 3.4×1038 addresses 5 Protocol Why protocols? Different types of communication occurring over the Internet Each type of communication requires a specific and unique protocol Definition Set of rules and standards that define a certain type of Internet communication 6 Protocol-2 Consider this type of conversation: "Hello." "Hello. Good afternoon. May I please speak at Joan?" "Okay, please wait for a while." "Thanks.“ Social protocol used in a telephone conversation Gives us confidence and familiarity of knowing what to do 7 Protocol stack Post Cargo Post Cargo Tehran Envelope Package Envelope Package INOC Envelope Envelope Loan Request Loan Request Formal Letter Formal Letter Persian Language Persian Language Persian Alphabet Persian Alphabet Paper and Pen Paper and Pen 8 Accounting Loan Manager Network protocol stack 9 Net protocols Some important protocols used over the Internet Hypertext Transfer Protocol (HTTP) Used to transfer HTML documents on the Web File Transfer Protocol (FTP) More general compared to HTTP Allows you to transfer binary files over the Internet Both protocols have their own set of rules and standards on how data is transferred Java provides support for both protocols 10 Ports Protocols only make sense when used in the context of a service HTTP protocol is used when you are providing Web content through an HTTP service Each computer on the Internet can provide a variety of services Why Ports? Ports locate appropriate process with is responsible to service A 16-bit number that identifies each service offered by a network server 80 : http, 21: ftp Given port values below 1024 11 Ports 192.168.1.2 90.98.210.156 192.168.1.123 192.168.1.1 192.168.1.3 12 Transport layer protocols TCP UDP Acronym for Transmission Control Protocol User Datagram Protocol or Universal Datagram Protocol Connection TCP is a connectionoriented protocol. UDP is a connectionless protocol TCP is suited for applications that require high reliability, and transmission time is relatively less critical. UDP is suitable for applications that need fast, efficient transmission, such as games. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients Use by other protocols HTTP, HTTPs, FTP, SMTP, Telnet DNS, DHCP, TFTP, SNMP, RIP, VOIP.Ping Java Classes ServerSocket, Socket DatagramSocket,DatagramPacket Usage 13 Java network api 14 url vs socket Socket programing Working with sockets to do network operation. It work on transportation layer(building its own application based on it) URL processing Work with URL objects Based on HTTP protocol( don’t need to work with underlying transport layer e.g. sockets) 15 socket Definitions: Software abstraction for an input or output medium of communication Communication channels that enable you to transfer data through a particular port An endpoint for communication between two machines A particular type of network communication used in most Java network programming Java performs all of its low-level network communication through sockets 16 The ServerSocket Class 17 18 19 The Socket Class 20 21 22 23 24 end 25