Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 39 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
39
Dung lượng
2,83 MB
Nội dung
Networking Session 7.1 Topics Signals on Networks Data and Packets Message Addressing Routing Networks and Protocols Host addressing Ports and Processes Windows Phone Starting with the Signal If we wanted to talk to a friend next door we could this by flashing our bedroom light In this case the data media would be light We can send a (light on) and a (light Windows Phone Signals in Windows Phone Windows Phone Programs Internet Programmer Interface WIFI Cellular USB When a Windows Phone communicates over a network it uses a variety of methods But the program always uses the same software interface to send data Windows Phone The Network Information classes using Microsoft.Phone.Net.NetworkInformation; This namespace holds classes that can be used to determine the connections available to an application when it is running The libraries are already loaded, we can add the namespace to make it easier to use Windows Phone Getting Network Information if (DeviceNetworkInformation.IsWiFiEnabled) { // Got Wifi } An application can test the DeviceNetworkInformation class properties to determine connection state There are a number of properties available to be tested Windows Phone Phones and Networks It is important that a Windows Phone application is written with network failure in mind The user might put the phone into “Aircraft” mode and turn off all connections Or they might drive their car into a tunnel An application must respond sensibly to this Windows Phone Demo Demo 1: Network Status Windows Phone Building up Packets Just a single bit does not give us much data transfer capabilities In real life we would assign meaning to certain patterns “Three flashes means ‘Bring Pizza’” Windows Phone Networks and Octets Modern networks send everything around in terms of bit data items In network terms these are called “octets” An octet can hold 256 different possible values 0000000 to 11111111 We can send larger ranges of data by sending a number of octets together to form a packet Windows Phone Routing and Packets Note that when a packet is “routed” in this way it is not actually passed on You can’t say that a packet is like a physical envelope which is handed from one person to another Instead the packet is re-sent with the new destination address Windows Phone Networks and Media A given local area network could actually use a number of different physical media You can have a wired network at home, along with a WIFI connection Your phone can also make use of GPRS data connections A single local area network can share a number of different media types at the physical level Windows Phone Networks and Protocols The Internet is based on a number of protocols These are rules that set out how different parties in a connection should collaborate to pass data between them There are protocols at a range of different levels to manage addressing of systems and the routing of data between them Windows Phone Stations and Addressing The network address of a station is a set of numeric values that identify that machine on the internet However, it is useful to address a station by more meaningful name The Domain Naming System (DNS) provides a way that a system can request the network address of a station with a particular name Windows Phone Name Resolution Stations on the network each have a unique internet address: 150.237.176.24 This is the internet address of our web server However we would like to use DNS names www.hull.ac.uk A station can send a name to a special system on the internet which will look up Windows Phone Domain Name System When a system first connects to a local network it will broadcast a request for information about that network Part of the reply will identify the DNS server for that network The system then knows who to ask The DNS server will also forward requests for addresses if it doesn’t have the required address Windows Phone Addresses and Subnets Systems on a particular physical network may be placed in a subnet These systems will not be directly addressable from outside the network, but the router will perform address translation when the systems on the subnet connect out to the internet Many cellular networks are organised like this Phones can originate connections but cannot Windows Phone Conversation Topics When we talk to our friends we might have a number of different topics Sports TV We could expand a packet to include “topic” information Windows Phone Networks and Ports The internet has a similar arrangement When we connect to a remote system we are really connecting to a process on that system Web server Mail server A process will sit behind a particular port number Windows Phone Well Known Ports The internet has reserved some port numbers for “well known” services The web server is behind port 80 We can use port numbers of our own for services that we create However these might not be transferred onto the network A router may act as a firewall and restrict use of certain port numbers by not forwarding their Windows Phone Connections and Datagrams Networks can pass two kinds of data Datagram We send the package and don’t care if it was received or not Connection It is important to us that the entire packet is Windows Phone Datagrams Datagrams are used in situations where we don’t want/need each packet to be acknowledged If we are sending a video stream there is no time to re-transmit missing data, we just have to live with a small degradation in the picture if data is missing The important thing with a datagram is that you want to send data as fast as possible Windows Phone Connection A connection sets up a data path between two processes that makes sure that data sent in one end arrives at the other This requires more work to set up and manage, but is useful when we are sending data that must arrive complete and undamaged Web pages Images Windows Phone UDP and TCP Datagrams can be sent over the internet using the User Datagram Protocol (UDP) Connections can be set up between processes using the Transmission Control Protocol (TCP) In either case the packets are sent and routed in exactly the same way, but are marked as being part of different kinds of conversation Windows Phone Review A network allows for packets of data to be sent between stations An internetwork provides for routing of packets between different networks A station has an address that identifies it on the local network and the inter-network Stations can send unacknowledged datagrams or set up connections that ensure delivery of data Windows Phone ... Windows Phone Name Resolution Stations on the network each have a unique internet address: 150.2 37.17 6.24 This is the internet address of our web server However we would like to use DNS names