java tutorial - Java Socket Programming - java programming - learn java - java basics - java for beginners
- A socket is one of the most fundamental technologies of computer network programming . It is a way of connecting two nodes on a network to communicate with each other. Socket-based software usually runs on two separate computers on the network, but sockets can also be used to communicate locally (interprocess) on a single computer. The Java Socket Programming has two sections.
- Java Server Socket Program
- Java Client Socket Program
Learn Java - Java tutorial - Sockets programming in Java - Java examples - Java programs
- Java Socket programming is used for communication between the applications running on different JRE. Java Socket programming can be connection-oriented or connection-less. Socket and ServerSocket classes are used for connection-oriented socket programming and DatagramSocket and DatagramPacket classes are used for connection-less socket programming. The client in socket programming must know two information:
- IP Address of Server, and
- Port number.
- A socket is simply an endpoint for communications between the machines. The Socket class can be used to create a socket.
- Socket is an endpoint for communications between the machines.
- The Socket class can be used to create a socket.
- The ServerSocket class can be used to create a server socket. This object is used to establish communication with the clients.
- Java socket programming in which client sends a text and server receives it.
Java Socket Programming (Read-Write both side)
- Client will write first to the server then server will receive and print the text.
- Then server will write to the client and client will receive and print the text.