Skip to content

Networking in Java with using TCP and UDP as connection Protocols

Notifications You must be signed in to change notification settings

PrajjawalBanati/Networking_In_Java

Repository files navigation

Networking_In_Java

Networking means communication between two or more devices connected in a network. Networking allows sharing of files, data among a group of users. Java allows user to develop a complete system to communicate between certain users.

Pre-Requistes

  • Difference between LAN-MAN-WAN.
  • What is WWW(World Wide Web)?
  • IP Address Concept
  • Port Number
  • MAC address
  • What is a Socket ?
  • Networking Protocols
  • TCP-IP
  • UDP

Java Networking

For networking in Java firstly we should know that how many sockets java allows us to use ? Java allows us to use two sockets:

  • Stream Sockets

Stream Sockets use TCP protocol to create a communication between two systems. Here data flows in the form of Continous Streams while the connection is in place.

  • Datagram Sockets

Datagram Sockets use UDP protocol in which the packets of information are shared between two systems. It is Connection-less service protocol.

Classes In Java

  • Different classes through which the connection related information can be accessed are :-
  • Different classes through which the communication could be done between two systems are :-
  • These all classes are included in java.net.* package.

Communication Using UDP

One-Way Communication

  • First Run the Server.java program so that server gets ready to recieve the messages then run the Client.java program.

  • img0

  • img1

Two-Way Communication

  • First Run the Server.java program so that server gets ready to recieve the messages then run the Client.java program.

  • img0

  • img1

Communication Using TCP

One-Way Communication

  • First Run the Server.java program so that server gets ready to recieve the messages then run the Client.java program.

  • img0

  • img1

Two-Way Communication

  • First Run the Server.java program so that server gets ready to recieve the messages then run the Client.java program.

  • img0

  • img1