• 00:50:41 Hours On demand videos
  • 9 Lessons
  • Full lifetime access
  • Access on mobile and tv

Java Network Programming

Hello and welcome to the Java Network Programming course. My name is Catalin and I'm going to be your instructor for this course.

Beginner 0(0 Ratings) 2 Students enrolled
Created by Catalin . Last updated Thu, 20-May-2021 English
What will i learn?
  • Learn fundamental Java Networking concepts.
  • Learn socket programming in java

Curriculum for this course
9 Lessons 00:50:41 Hours
Introduction To Networking
3 Lessons 00:10:30 Hours
  • Introduction about Java Networking 00:05:00
  • Networking Fundamentals and TCPIP Model 00:02:30
  • TCPIP Communication , Internet Protocol and Loopback Interface 00:03:00
  • Networking and Threads 00:06:00
  • Implementing Threads in Java 00:08:00
  • Create the first thread 00:08:25
  • Run Multiple Threads Concurrently 00:05:10
  • Sleep a Thread 00:05:14
  • Runnable 00:07:22
  • Basic computer Skill and Internet knowledge
  • Basic Java Knowledge
+ View more

Hello and welcome to the Java Network Programming course. My name is Catalin and I'm going to be your instructor for this course. We are going to cover network programming using one of the most used programming language Java, and I'm going to show you how to create network programs all from scratch. But first of all. Why network programming? Nowadays there are plenty of different devices that can be connected to a network: computers, laptops, smartphones, printers or even a TV. These devices have software written to connect to a local network or to the Internet. They have applications installed to browse internet, send emails, chat with your friends or send files. The main purpose of these applications is to transfer data between interconnected computers. Of course there are some other applications like an antivirus whose main purpose is to protect your computer but it has some level of networking built in. An antivirus application connects automatically to a special website, determines if your files need updating, download the proper files on installs them in the proper location.

Another example could be a multiplayer game which transfers data from the player computer to the game's data server and back. As you can see more programs are network aware and networking can add a lot of power to simple program, so writing software that is capable to transfer data between inter-connected devices becomes one of the most important programming skills today that you must have and this course will definitely make you a better programmer. Java is one of the first programming languages which allows you to write network programs. Java's network class library allows you to write network applications really easy as you will see in the next lessons. Java shines in the network communication level because Java is one of the only languages designed with network communication from the ground up. Java's network API simplify things and with just a few lines of code you can create a powerful network application. so here's the course roadmap the first thing we are going to do is to discuss about the concept of network communication from the very basic fundamental level that needs to be understood by everybody. Two chapters are included for those programmers who haven't worked yet with Java Threads or Java I/O. These two are very important topics in network programming and I want to ensure that all students have the basics before we start to code network programs. Next in the socket chapter we are going to code together the TCP client and the TCP server, a multi-threaded TCP server, a port scanner. How to ping a remote host address using Java code, how to get information about your network interfaces using Java code,validate IP addresses in different ways, browse internet and web scraping or how to get what data you want from a web page. In the next chapter we are going to find out what is the difference between TCP and UDP the most used transport layer protocols. Again we will code together a UDP client on a UDP server and we will see how a UDP server reacts when multiple clients try to communicate with it.

In the next three chapters we will learn how to create a file transfer application, how to send an email using SMTP protocol or how to write a simple web server in Java. For each application I've included all the theory you need to understand how the application works, the application source code is explained i n details line by line and in the end we are going to test the application and observe the code behavior. The course is filled with examples that illustrate the main presented concept or topics. Almost every lesson has a Java file attached which can be downloaded and can be edited by the students. So let's get started!

In this chapter we will discuss the concept of network communication from the very basic fundamental level that needs to be understood by everybody. 

What is a network?

A network is a group of interconnected computers and peripherals that is capable of sharing software and hardware resources between many users. Networks come in all sizes.They can range from simple network consisting of two computers to networks connecting millions of devices. Simple networks installed in homes enable sharing of resources such as printers, documents, pictures and music between a few local computers. The internet is the largest network in existence. In fact the term internet means a network of networks. The Internet is literal a collection of interconnected private and public networks. Business, small office networks and even home networks usually provide a shared connection to the Internet. All computers connected to a network that participate directly in network communication are classified as host or end devices. Hosts can send or receive messages on the network. In modern networks end devices can act as a client a server or both. The software installed on the computer determines which role the computer place. Servers are hosts that have software installed that enable them to provide information like email or web pages to other hosts on the network. Each service requires separate server software. For example, a host requires web server software in order to provide web services to the network. Clients are computer hosts that have software installed that enable them to request and display the information obtained from the server. An example of client software is a web browser like Internet Explorer. A computer with server software can provide services simultaneously to one or many clients.

Additionally a single computer can run multiple types of server software. In a home or small business it may be necessary for one computer to act a file server, a web server and an email server.  A single computer can also run multiple types of software.  There must be client software for every service required. With multiple clients install a host can connect to multiple servers at the same time. For example,  a user can check email and view a web page while instant messaging and listening to internet radio.

Communications between computers on a network is done through protocol suits. The most widely used and most widely available protocol suite is TCP/IP protocol suite. A protocol suit consists of a layered architecture where each layer depicts some functionality which can be carried out by a protocol. Each layer usually has more than one protocol options to carry out the responsibility that the layer adheres to. TCP/IP is normally considered to be a 4 layer system.

The 4 layers are as follows:

  • Application Layer
  • Transport Layer
  • Internet or Network Layer
  • Network Interface Layer

Let say, the Computer A with IP address is the source, which wishes to send a data to the Computer B with IP address (of the network at the right) which is the destination over a Ethernet network, consisting of switches and routers. Let us now examine what layers are involved Application layer: This layer will form the data intended to be actually read by the destination PC and this layer also defines the application and format the data accordingly.  For example, if the sender PC uses a web-browser to communicate with PC at the destination, then it will use the application layer protocol "HTTP". Another example of application layer protocol is FTP (File Transfer Protocol). Let us understand that this layer in the source PC will define application, the data format and the actual data, intended to be read only by the destination PC. Data coded according to application layer protocols are then encapsulated into one or more transport layer protocols which in turn use lower layer protocols to effect actual data transfer. Transport Layer: This layer helps to identify The application for which the data belongs and hence provides end to end data transfer. The identifier of the application is known as the “Port Number”, which is of 16 bits. For example when you are browsing web, the destination port number will be 80. There are specific port numbers for specific standard application. It s sufficient to understand that port numbers help to identify and differentiate among different processes in a computer. Essentially, this layer adds one header to thI original data; which carry certain information needed to deliver correctly to the right application properly. This header is one of the two type’s: TCP (Transmission Control Protocol) or UDP (User Datagram protocol). The application decides on the type of Transport layer header. Each of the type of header has the most important entries of source and destination port numbers each of 16 bits along with some other information. Internet layer This layer gets data from a source network to the destination network. This generally involves routing the packets across a network of networks. This is where IP(Internet Protocol) comes in. IP performs the basic task of getting packets of data from source to destination. This layer again adds one header to the segment carrying certain more information, to make data find its route to the destination computer. This header gives identification to the computers involved and some other information, helping it’s to find its path to the destination in this wide network. The most important fields in the IP header are the Source IP address and the Destination IP address. In our example those fields will be (the source IP) and (the destination IP). Network Interface Layer: This layer is responsible for encoding and transmitting data over network communications media. It operates with data in the form of bytes which are sent from the Network Interface layer of the sending source and received at the Network interface layer of a destination source. When you hook up a computer using an Ethernet cable you are connecting that computer on the Network Interface layer. This Physical layer is the lowest level of the TCP/IP Model. In a Ethernet link, this layer adds one header and one trailer. The most important information being carried over here are the hardware addresses, media access control addresses. – the MAC address When the packet arrives at the destination computer, the destination computer will strip off frame header and trailer and look into the IP header. It discovers that the packet is meant for it only. It now has the explicit right to strip off the Network/IP header and look further into Transport layer header and see into the port address, to identify the application for which the data is meant for ( Different web-pages in a same computer are also differentiated by port numbers). Finally the transport layer header (TCP or UDP) is stripped off and the data is sent to the relevant application for final processing.

+ View more
Other related courses
01:07:24 Hours
Updated Fri, 12-Feb-2021
0 3 Free
07:51:58 Hours
Updated Mon, 08-Feb-2021
0 3 Free
01:36:13 Hours
Updated Wed, 10-Feb-2021
0 2 Free
02:51:15 Hours
Updated Mon, 15-Feb-2021
0 8 Free
01:44:42 Hours
Updated Wed, 03-Mar-2021
0 11 Free
  • 00:50:41 Hours On demand videos
  • 9 Lessons
  • Full lifetime access
  • Access on mobile and tv
close button