1Networking Support In JavaNelson Padua-PerezChau-Wen TsengDepartment of Computer ScienceUniversity of Maryland, College ParkAdvanced Programming ConceptsObjected-oriented support in Java forException handlingStreamsThreadsGraphics user interfaces (GUIs)NetworkingLook at networking as example of OO design2OverviewNetworkingBackgroundConceptsJava’s objected-oriented viewJava’s networking API (Application Program Interface)Network applicationsThis lectureNext lectureNetworking BackgroundDefinitionSet of computers using common protocols to communicate over connecting mediaHistory1969 ARPANET1986 NSFnet1995 Internet3Networking ConceptsProtocolsNetwork modelInternet addressesPortsSocketsURLsReliabilityConnection vs. packet orientedTCP vs. UDPProtocolsDefinitionFormal description of formats and rulesUsed forMessage formatsSequence & order of actionsNeeded by computers to exchange informationVital for networking4Protocols – Email DeliveryNetwork ModelOpen Systems Interconnection (OSI) modelMultiple layers (7)One function each Each layer relies on previous layerDesigned to reduce complexity using abstraction5Network Model – LayersPhysical layerTransmit data as 0’s and 1’s over connectionData-link layerBetween two physically connected computersNetwork layerBetween any two computers connected to network Transport layerDeliver network data to applicationApplication layerBetween two applications using networkNetwork Model – VOIP ExampleVoice over IP (VOIP)PhysicalNetworkData-linkTransportApplication6Internet (IP) AddressUnique address for machine on internetGet from ISP when connecting to internetAllows network to find your machineFormat32-bit unsigned integer ⇒ 128.8.128.8Domain name ⇒ cs.umd.eduName and address for local machineLocalhost127.0.0.1Internet (IP) AddressDomain Name System (DNS)DNS servers on internet Can look up IP address associated with name DNS server may need to query other DNS serversedu DNS server queries umd.edu server to find cs.umd.eduMachine can have multiple IP addressesVirtual machines7Internet (IP) AddressProblemRunning out of 32-bit IP addressesCaused by initial address allocationStanford & MIT given more IP addresses than ChinaSwitching to 128-bit IP addresses in IPv61+ million addresses per square meter on EarthPortsAbstraction to identify (refine) destinationProvide multiple destinations at single IP addressFormatUnsigned 16-bit integer (0 to 65,535)Ports 0 to 4096 often reserved & restrictedMany ports pre-assigned to important services21 ftp (file transfer)23 telnet (remote terminal)25 SMTP (email)80 http (web)…8SocketsApplication-level abstractionRepresents network connectionImplemented in softwareSupports both UDP and TCP protocolsHistoryIntroduced in Berkley UNIX in 1980sNetworking APISocketsSocket is bound to port numberReceives data packetRelays to specific portportportport port portTCP or UDPport #, dataPacketapp app app app appTransport Layer9Uniform Resource Locators (URLs)Represent web resourcesWeb pagesArbitrary files…Exampleshttp://www.cs.umd.edu/index.htmlftp://www.cs.umd.edu/pub/doc/csd_policies.pdfhttps://login.yahoo.com/file://dir/my.txtUniform Resource Locators (URLs)Consists ofProtocolhttpftphttps (secure http)file…IP address (or domain name)Port (optional)http://www.cs.umd.edu:80/Reference to anchor (optional)10ReliabilityReliableData guaranteed to Arrive in orderMore overheadSlowerReliabilityUnreliableData not guaranteed toArrive ⇒ lost dataArrive in order ⇒ out of order dataLess overheadFasterTransfers responsibility to higher layerExtra work for higher layerCompensate with timeoutsEstimate packet lost if longer than average round trip11ReliabilityReliable layersData-linkUnreliable layersPhysicalNetworkCan be eitherTransportReliable ⇒ TCPUnreliable ⇒ UDPApplicationWays To Connect1. Connection-oriented2. Packet-oriented12Connection OrientedApproachReserve (single) communication channelSend stream of data along channelAlso called Circuit switchingStream orientedExampleTelephone call (current)Connection OrientedProtocol13Connection OrientedAdvantagesSimpler schemeEasier to useHigher quality communicationLess likely to lose data (at network layer)Packet OrientedApproachBreak message up into packets Transmit packets separately Assemble packets at destinationAlso calledPacket switchingConnectionlessExampleUS MailVOIP (Voice over IP)14Packet OrientedProtocolPacket OrientedAdvantagesCan share communication channelHigher utilization of channels Can utilize multiple channels at onceCan reroute around failed channels15InternetNetwork layerInternet Protocol (IP)Transport layerUser Datagram Protocol (UDP)Transmission Control Protocol (TCP)Internet16Internet Protocol (IP)Packet orientedPackets routed between computersUnreliableUser Datagram Protocol (UDP)Packet oriented Message split into datagramsSend datagrams as packets on network layerUnreliable but fastApplication must deal with lost packetsExamplesPingStreaming multimediaOnline games17Transmission Control Protocol (TCP)Connection orientedMessage split into datagramsSend datagrams as packets on network layerProvides illusion of reliable connectionExtra messages between sender / recipientResend packets if necessary Ensure all packets eventually arriveStore packets and process in orderTransmission Control Protocol (TCP)Reliable but slowerApplication can treat as reliable connectionDespite unreliability of underlying IP (network)Examplesftp (file transfer)telnet (remote terminal)http
View Full Document