Tag Archives: Java-Networking

Java.net.HttpURLConnection Class in Java

HttpURLConnection class is an abstract class directly extending from URLConnection class. It includes all the functionality of its parent class with additional HTTP specific features. HttpsURLConnection is another class which is used for the more secured HTTPS protocol. Where is it used? It is one of the popular choices among the Java developers for interacting… Read More »

Working with UDP DatagramSockets in Java

DatagramSockets are Java’s mechanism for network communication via UDP instead of TCP. Java provides DatagramSocket to communicate over UDP instead of TCP. It is also built on top of IP. DatagramSockets can be used to both send and receive packets over the Internet. One of the examples where UDP is preferred over TCP is the… Read More »

Simple Calculator via UDP in Java

Networking is a two-way communication between a host and a server, rather an exchange of information. Any server is setup to respond to specific queries as requested by a client. There are many different kinds of server based on the utility they provide to the users. Some examples include File Server, Application Server, Domain Server… Read More »

Simple Calculator using TCP in Java

Prerequisite: Socket Programming in Java Networking just doesn’t conclude with a one-way communication between the client and server. For example consider a time telling server which listens to request of the clients and respond with the current time to the client. Real-time applications usually follow a request-response model for communication. Image Source: http://images.slideplayer.com/1/220171/slides/slide_3.jpg As depicted… Read More »

Reading from a URL using URLConnection Class

In the previous article, we saw how we can create a URL object and get the information of any resource on the internet. But barely getting the state-information is not the true motive of a real world application. To retrieve the information, process it and sending the results back to the server, or just display… Read More »

URL class in Java with Examples

The URL class is the gateway to any of the resource available on internet. A Class URL represents a Uniform Resource Locator, which is a pointer to a “resource” on the World Wide Web. A resource can point to a simple file or directory, or it can refer to a more complicated object, such as… Read More »