<< Previous

Prepare another machine to test this chatting program. (You can test this application on a single machine. Find this example at the end of this section.)

Let's say Machine-A the original machine in which this application files are saved and Machine-B in which the copy of the application files are copied.
Machine-A runs a server then Machine-B connects to Machine-A and sends a data to Machine-A then Machine-A (server) will display the received data and vice versa.

Copy all deployed files to Machine B.

Move to the directory where the deploy application files are located. Double click on the file "MyApplication.bat" then the application will pop up with a Java console. (Machine-A, Machine-B both)

       

Even though we have left the 'server only' check box unchecked, because we didn't specify the host address in the moment of deploying this application, above message will pop up.

Start server by selecting 'Run-> Start Server' menu. (Machine-A, Machine-B both)

       

Now both of machines runs server on itself.

If the IP address of Machine-A is '192.168.1.145' and the IP address of Machine-B is '192.168.1.146', set the Host address of Machine-A as '192.168.1.146' (IP address of Machine-B which will be a server to Machine-A) and set the Host address of Machine-B as '192.168.1.145' like below. Then the both of application will check the connectivity to each other and display the message 'Connection to 192.168.1.146(146 for Machine-A, 145 for Machine-B):6001 is available'

       
        Note : This is a screen of Machine-A.

Type 'Hello?' and press 'Send' button in Machine-A
       

Then this will be displayed on the screen of Machine-B like below.
       

Type 'Hi, there?' and press 'Send' button in Machine-B
       

Then this will be displayed on the screen of Machine-A like below.
       

Running this example on a single machine

Deploy two applications with a different server and client port number because a port cannot be communized by multiple applications.
Application A : Client port 6001, server port 6000.
Application B : Client port 6000, server port 6001. (to match the input/output port each other)
Start the both of applications and start server.
Set the Host address of both applications '127.0.0.1' (localhost, the machines running this application itself).
Then, you will find the two applications working.

<< Previous

d1300-chat-1.htm"><< Previous