Networking By Dipendra Verma Karrox Technologies
Networking Basics  TCP  TCP  ( Transmission Control Protocol ) is a connection-based protocol that provides a reliable flow of data between two computers.  UDP UDP (User Datagram Protocol) is a protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival. UDP is not connection-based like TCP.
Understanding Ports & IP Address Every computer in the network has a unique identification called IP Address  The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer.  Port numbers range from 0 to 65,535 because ports are represented by 16-bit numbers. The port numbers ranging from 0 - 1023 are restricted; they are reserved for use by well-known services such as HTTP and FTP and other system services. These ports are called  well-known ports . Your applications should not attempt to bind to them.
Classes in java.net package. InetAddress Factory Methods getLocalhost(),getByName(),getAllByName() Instance Methods getHostName(),getHostAddress(),getAddress()  example ServerSocket ServerSocket(port).accept() Socket Socket(ipaddress,port)connect(),getInputStream(), getOutputStream()
What is Socket? A  socket  is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent.  You use ServerSocket class to create a Socket where the server listens for a remote client. Create the  Server Listening for  client to connect Get the reference of the  streams Communicate  with the client Close  Socket   complete program
Writing the client Application Accepting  the data to be sent. Connect  to the Server Obtain the  Stream Reference Read write data and close  connection Complete Client  Application
What is Datagram  A datagram is an independent, self-contained message sent over the network whose arrival, arrival time, and content are not guaranteed.  DatagramSocket Class DatagramPacket Class  Server example Client example

Networking

  • 1.
    Networking By DipendraVerma Karrox Technologies
  • 2.
    Networking Basics TCP TCP ( Transmission Control Protocol ) is a connection-based protocol that provides a reliable flow of data between two computers. UDP UDP (User Datagram Protocol) is a protocol that sends independent packets of data, called datagrams, from one computer to another with no guarantees about arrival. UDP is not connection-based like TCP.
  • 3.
    Understanding Ports &IP Address Every computer in the network has a unique identification called IP Address The TCP and UDP protocols use ports to map incoming data to a particular process running on a computer. Port numbers range from 0 to 65,535 because ports are represented by 16-bit numbers. The port numbers ranging from 0 - 1023 are restricted; they are reserved for use by well-known services such as HTTP and FTP and other system services. These ports are called well-known ports . Your applications should not attempt to bind to them.
  • 4.
    Classes in java.netpackage. InetAddress Factory Methods getLocalhost(),getByName(),getAllByName() Instance Methods getHostName(),getHostAddress(),getAddress() example ServerSocket ServerSocket(port).accept() Socket Socket(ipaddress,port)connect(),getInputStream(), getOutputStream()
  • 5.
    What is Socket?A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent. You use ServerSocket class to create a Socket where the server listens for a remote client. Create the Server Listening for client to connect Get the reference of the streams Communicate with the client Close Socket complete program
  • 6.
    Writing the clientApplication Accepting the data to be sent. Connect to the Server Obtain the Stream Reference Read write data and close connection Complete Client Application
  • 7.
    What is Datagram A datagram is an independent, self-contained message sent over the network whose arrival, arrival time, and content are not guaranteed. DatagramSocket Class DatagramPacket Class Server example Client example