
Explore the TCP/IP protocol suite and its four-layer model, and how data is encapsulated and routed with ports, IP addresses, and headers.
Compare TCP and UDP transport protocols used by IP, balancing reliability and overhead, while TCP ensures reliability via segmentation, acknowledgments, and retransmission, and UDP offers best-effort delivery.
Explore the loopback interface, a special virtual network interface used to communicate with the local machine for diagnosis and troubleshooting, with 127.0.0.1 mapping to localhost.
Create the first thread by extending the thread class, start a new thread, and override run to print server messages from client 1 to 99, with named threads for tracking.
Create and run a second server thread to observe concurrency. The JVM's thread scheduler assigns CPU time in quanta, and priorities set via setPriority influence execution, yet ordering remains non-deterministic.
Learn how to pause a Java thread with the static sleep method, handle interruption, and manage timing to balance CPU usage across lightweight and CPU-intensive threads.
Write data to a file with FileOutputStream, using constructors with a path and append mode, then write bytes or strings via getBytes, handle exceptions with try-catch, and close the stream.
Use input stream reader and output stream writer to convert byte streams to character streams for multilingual text and network communications, explaining ASCII and Unicode character sets.
We examine the default charset (UTF-8) using getEncoding and note that the JVM adopts the system setting. We show how OutputStreamWriter with ASCII fails to represent Japanese, yielding question marks.
Explore writing to and reading from a text file with InputStreamReader, including flushing and closing, and iterating over characters until end-of-file to display the text.
Learn how Java buffered streams improve text transfer efficiency by wrapping unbuffered streams with buffered reader and writer, using readLine and write, and tuning buffer sizes.
Instantiate a ServerSocket on port 9090, handle IOException with try-catch, and report when a port is open. Show port scanning concepts with netstat -a to reveal open ports locally quickly.
Learn how a TCP server accepts client connections with accept(), uses the socket's input and output streams to exchange messages, and test with Telnet or a browser.
Learn how a Java TCP server accepts multiple clients by using a loop and a stop flag, handles IO exceptions with try-catch, and closes streams and sockets after each client.
Explore the InetAddress class, Java's encapsulation of an IP address, and how to resolve hostnames using getLocalHost and getByName, then obtain IP addresses and hostnames with getHostAddress and getHostName.
Create a Java socket client that connects to a server at localhost port 9090, uses InetAddress, and exchanges hello messages via input and output streams before closing resources.
Learn how to build a remote port scanner using the Socket class to test a range of tcp ports on a target host, with user input validation and permission cautions.
Learn how to ping a host in Java to check if a server is up before connecting, using the net address reachable method and the process class for cross-platform ping.
Learn how to use URL and URLConnection in Java to read web data, perform web scraping, and extract the Oracle stock price from HTML with regex.
Build a simple UDP client in Java that sends a text message via datagram socket and packet to a server and waits for a response, using localhost and port 9090.
Create a UDP server that receives before sending on port 9090 using a single datagram socket and handles multiple clients.
Learn how to send an SMTP email with Java sockets and understand SMTP basics, including DNS resolution, MTA routing, and commands like HELO, MAIL FROM, RCPT TO, and DATA.
Build a Java smtp socket client that connects to a smtp server on port 25, exchanges smtp commands, and verifies responses with codes such as 220, 250, 354, and 221.
Send emails using a Java program with a local SMTP server and a Gmail account, and verify delivery by checking the inbox for a test email.
Explore how HTTP powers web communication through a basic web server workflow, including request parsing, headers, and responses. Understand HTTP's connectionless, stateless, and media‑independent nature, plus GET and POST methods.
Basic Web Server Application written in Java using sockets
Update April 17, 2017: Two students asked me for subtitles. I removed the auto-generated subtitles and I added right subtitles for every lesson. Also, sound quality has been improved for some lessons. Thanks for your suggestion! Now, every student can follow this course more easily.
Update September 17, 2016: Some of my students asked me for a chat application. So
I created the application (GUI included) and I added it in chapter 9.
Now, you can download the application, run it and view the source code. Enjoy!
Update August 4, 2016: Added: quizzes for learning reinforcement.
---------------------------------------------------------------
Student Testimonials!
★★★★★
The best course ever on udemy , it teaches student not only the how to build network application but also discuss all programming topics like streams , thread that involved on building network applications ,the teacher explains while he is coding every step in details , and explain why he prefered this method over that method . Mr. Catalin provides detail answers for any question in quick time . Take this course and you will master building network applications
Rashed
★★★★★
Professional and up to the point. It tells the beginners every single step about Java Network Programming which is very nice. It makes the difficult things look easy.
Sobhan N.
★★★★★
Excelente curso, esta muy bien explicado y la sintaxys del codigo es muy clara, solo me gustaria ver streaming de audio en tiempo real.
Juan
Course Description
With over 45 videos this online Java training course is designed to provide a solid foundation in Java network programming and network communication.
---------------------------------------------------------------
Learn something new
Network programming is one field which everybody uses but is still considered an advanced topic.
---------------------------------------------------------------
Open
Source Code
All source code shown in this course is also available for download. Students can create their own projects using the downloaded java files.
---------------------------------------------------------------
Combine
theory with practice!
Each
chapter has an intro video to
cover basic theory needed to understand the rest of the material
covered.
In the first chapter you will learn the concept of network communication from the very basic fundamental level that needs to be understood by everyone.
Two other chapters are included in this course for those programmer who haven’t worked yet with java threads or java IO. These two are very important topics when you want to build a network application and I want to ensure that all students have the basics before we start to code Client – Server applications.
In the Socket (Java Socket programming) section you will start to write simple TCP servers or TCP clients. Also, you will learn how to create a multi-user or a multithreaded server and we are going to test each written application. We will connect multiple TCP clients to a multithreaded server and we will observe the TCP server behavior and how it makes to respond to multiple clients at the same time.
In this chapter I will cover some other important network programming topics:
Scan a remote host for open ports
Get network interface hardware information
Validate an IP address in different ways
Ping a remote host address using java code
Browse internet using java code.
Web scrapping – get what data you want from a web page
UDP chapter focus on the difference between the most used Transport Layer protocols: TCP and UDP. We will write together an UDP server and an UDP client. The interesting part of this chapter comes after we will run the code. The next chapters present some useful applications:
Send an email
Transfer files between a server and a client using TCP sockets
A small web browser.
The code is explained in details, line by line. All the needed theory is presented in the application intro and we will test each application after the source code is explained.
So let’s start the interesting journey now!
Cheers,
Catalin Baba