|
Network Programming This website demonstrates using wikis as teaching and learning tool. The course instructor is happy to share the teaching materials here with those who find it readable. |
Lecture /
Introduction to NetworkingA Network Programming Lecture by Steven Choy Lecture Overview: Networking Stacks and Layers - Internet Protocol - IP Addressing -- IP Addressing - for Private Networks - IP Subnets - TCP (Transmission Control Protocol) - UDP (User Datagram Protocol) - Domain Name System - Firewalls and Proxy Servers - Internet Protocol version 6 - Overview of basic concepts for network programming Networking Stacks and Layers
Internet Protocol
Windows has a program that lets you trace a packet movement between routers. Type tracert <somehost> in the command prompt. Replace <somehost> with some hosts you want to test.
If you are using Windows, type ipconfig or ipconfig /all in the Command Prompt. It will then list the host name, IP address, subnet mask, gateway, and even the MAC address of your network card.
If you used a router/proxy, your IP address as seen by the server is different. Try the following websites.
Why?
Public versus private IP addresses: Besides the reserved IP addresses (0.0.0.0/8 and 127.0.0.0/8) mentioned above, there are other addresses not used on the public Internet. These private subnets consist of private IP addresses and are usually behind a firewall or router that performs NAT (network address translation). NAT is needed because private IP addresses are nonroutable on the public Internet, so they must be translated into public IP addresses before they touch the Internet. Private IPs are never routed because no one really owns them. And since anyone can use them, there's no right place to point a private IP address to on the public Internet. Private IP addresses are used in most LAN and WAN environments, unless you're lucky enough to own a Class A or at least a Class B block of addresses, in which case you might have enough IPs to assign internal and external IP addresses. (Extract from IP subnetting made easy)
IP addressing
1. What is the class of the network for each of the following IP addresses?
(a) 12.12.12.12
(b) 125.44.25.223
(c) 220.32.34.125
2. Why there is no network that owns an IP address such as 127.x.x.x?
3. What is the subnet mask for a non-subnetted class C network?
4. Can you send data to 234.5.6.7? If so, what will happen?
IP Addresses for Private Networks(Extracted from IP Addressing - Linux Knowledge Base and Tutorial
In some cases, there is no need to have unique IP addresses, since the network will never be connected to the rest of the world. For example, in a factory where the machines communicate with each other via TCP/IP. There is no reason for these machines to be accessible from the Internet. Therefore, there is no need for them to have an official IP address.
You could just randomly assign IP addresses to these machines and hope that your router is configured correctly not to route the packets from these machines. One slip and you have the potential for not only messing up your own network, but someone else's as well.
The solution was provided in RFC-1918. Here, three sets of IP address were defined for use in "private" networks. These won't be routed and there is no need to coordinate their use with any of the registrations agencies. The IP addresses are:
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
As you can see that there is just a single class A address, but 16 class B and 255 class C networks. Therefore, no matter what size your network is, you can find a private network for your needs.
IP subnets
Using the subnet technique, network administrators can divide a network into multiple subnetworks and connect subnetworks with routers.
IP Datagrams
TCP (Transmission Control Protocol)
UDP (User Datagram Protocol)
IP family of services
Telnet is a service that allows users to open a remote terminal session to a specific machine. This allows Unix users, for example, to access their account from terminal servers, or desktop machines. Since Unix servers are intended to support multiple users, a telnet session is often used as only one person can access the machine from the local terminal (using a keyboard and monitor). Telnet allows many users to connect over the network, and to access their accounts as if they were doing so locally.
The ability to transfer files is extremely important: even before the World Wide Web, people distributed images, documents, and software, using the File Transfer Protocol (FTP). FTP allows a user to login (using a special username and password), or to attempt an anonymous login (by using the username of anonymous). FTP servers will often grant different access permissions depending on the user. For example, an anonymous account might be unable to write a file to the server, but may be able to read all files. FTP uses two TCP ports for communication – port 21 is used to control sessions and port 20 is used for the actual transfer of file contents.
Email has become a vital part of most people’s lives. With the exception of web-based email, or specialized accounts, the majority of people access their email using the Post Office Protocol, which uses TCP port 110. Messages are stored on a server, retrieved by an email client, and then deleted from the server. This allows offline reading of mail, without being connected to the Internet.
While many browsers and email clients support only POP3, some also support the Internet Message Access Protocol (IMAP). This protocol is less popular, as it requires a continual connection to the mail server, and thus increases bandwidth consumption and disk usage since messages are not stored on the user’s system. IMAP allows users to create folders on the mail server, and also allows online searching of mail.
The Simple Mail Transfer Protocol allows messages to be delivered over the Internet. You might find the separation between retrieving mail, and sending mail, a little strange. However, it actually simplifies the process considerably, and allows different mail retrieval protocols to be used, or custom mail accounts.
HTTP is one of the most popular protocols in use on the Internet today, and made the world-wide-web possible. HTTP is an extremely important protocol, and Java includes good HTTP support.
The WHOIS protocol allows users to look up information about a domain name. You can find some surprisingly useful information by doing this, such as the address of a company, who registered the domain name, and contact details for the registration.
(Extracted from Chapter One - Networking Theory, Java Network Programming & Distributed Computing, by David Reilly and Michael Reilly (ISBN: 0201710374))
Domain Name System
Firewalls and proxy servers
(Source: Java Network Programming & Distributed Computing, by David Reilly and Michael Reilly)
Internet Protocol version 6
Improvement by IPv6
IPv6 Information Page (www.ipv6.org) - http://www.ipv6.org/
RFC Sourcebook for IPV6- http://www.networksorcery.com/enp/protocol/ipv6.htm
Overview of basic concepts for network programming
Thanks for ReadingIf you would rather like to have this lecture note in printed format, please click the print action link in the top right corner. If you find any problem in this lecture note, please feel free to tell Steven via steven@findaway.hk. |