Web Analytics
Send Messages from Client to Server in Java -->

Send Messages from Client to Server in Java

Learn how to build a Client-Server system and send messages from the client with Java using the java.net package.

The java.net package in Java contains classes and interfaces to build distributed Java Applications on the basis of Socket Programming.

A Socket is one endpoint of a two-way communication link between two programs on a network.It is a combination of an IP Address and a binding Port number. In the example below, we use the localhost (127.0.0.1) as the preferred IP Address and a Port number 2222.

Client Program Example
Client Program

Server Program Example
Server Program

Implementations


Press Ctrl+C to terminate a Program.


You may like these posts

  1. To insert a code use <i rel="pre">code_here</i>
  2. To insert a quote use <b rel="quote">your_qoute</b>
  3. To insert a picture use <i rel="image">url_image_here</i>