Hello everyone,
I am in big trouble, actually, I am developing a chat in Java. I am still on the server part, but the problem is that when i am clicking on a button to instantiates a class, the whole program freeze, please help me to figure out this problem. I am using Netbeans as compiler. I just want to server to listen to the port when the button "btnServerOn" (in ServerConnect) is clicked.

Thanks in advance.


This is the "Server" class:

package ignisv4;
import java.io.*;
import java.net.*;


public class Server {

 int portNumber = 5000;
 String serverStatus;

 Socket clientSocket = null;
 PrintWriter out = null;
 BufferedReader in = null;

 public void setPortNumber(int PN){
        this.portNumber = PN;
 }
 
 public int getPortNumber(){
     return portNumber;
 }

 public String getServerStatus(){
     return serverStatus;
 }

 public void setServerStatus(String status){
     serverStatus = status;
 }

 public void createServer(){


     try{
        ServerSocket ss = new ServerSocket(portNumber);
          Socket incoming = ss.accept();
        //InputStream incomingStream = new InputStream();
        //incomingStream = incoming.getInputStream();

        BufferedReader in = new BufferedReader  (new InputStreamReader(incoming.getInputStream()));
        PrintWriter out = new PrintWriter  (incoming.getOutputStream(), true /* autoFlush */);


        boolean done = false;


        while (!done)
        {
          String messageline = in.readLine();
          if (messageline == null){
              done = true;
              setServerStatus("OFF");
          }
          else
          {
            out.println("Echo: " + messageline);
            setServerStatus("ON");

            if (messageline.trim().equals("BYE"))
              done = true;
              setServerStatus("OFF");
          }
        }

        incoming.close();

     }catch(Exception e){}

 }

This is the "ServerConnect" class:

package ignisv4;
public class ServerConnect extends javax.swing.JFrame {

    /** Creates new form ServerConnect */
    public ServerConnect() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        btnServerOn = new javax.swing.JButton();
        txtServerStatus = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        btnServerOn.setText("Server On");
        btnServerOn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnServerOnActionPerformed(evt);
            }
        });

        jLabel1.setText("Server Status");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(112, 112, 112)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnServerOn)
                    .addComponent(txtServerStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(85, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(141, Short.MAX_VALUE)
                .addComponent(btnServerOn)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtServerStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(110, 110, 110))
        );

        pack();
    }// </editor-fold>

    private void btnServerOnActionPerformed(java.awt.event.ActionEvent evt) {

        Server cs1 = new Server();
        cs1.createServer();
        txtServerStatus.setText(cs1.getServerStatus());

    }


    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ServerConnect().setVisible(true);
            
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton btnServerOn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField txtServerStatus;
    // End of variables declaration

}

ss.accept(); blocks its thread waiting for an incoming connection. Because you run that on the Swing thread everything gets blocked, and the whole program freezes until an incoming connection is received. You normally spawn a new Thread to run the accept() in.

ps. Its not a good idea to have a catch(Exception e){} because that guarantees that you won't see any errors! Put an e.printStackTrace(); in the catch so you cen see what's gone wrong after an error.

Thank you very much for your help James. But, I am new to socket programming, can you please give an idea on how to solve this problem please. What i should do ?? Please, i need this in order to continue working on my chat program!!

Many thanks in advance.

Briefly, you need to run your createServer in a new Thread. One way to do that is to make your server class extend Thread, and change the name of the createServer() method to run(). You can then call cs1.start(); to execute the run() method in a new Thread.
Have a look at the API for the Thread class.
There are also lots of good introductory materials for Java Threads on the web.

In addition to what James has said; if you want to be able handle more than one client you will need to create a thread for each client that connects.

Thanks again. I have done what you have said(that is creating a new thread) and the program doesn't freeze anymore.

But, now i am having a new problem, the :

txtServerStatus.setText("Status: " + cs1.getServerStatus());

is returning only null value. Its like the method run() is not running at all. Could you please help me of this. Thanks a lots.

Thanks for the tip jasimp but I am still learning, I am trying for only one client first then I will move to multithread chat.

At a guess - your call to getServerStatus() comes immediately after the start(), so it's executed in the current thread immediately. Only when that thread finishes executing will the new thread get to run and initialise the server.
If you declare String serverStatus; as String serverStatus = "Not yet started"; it may become clearer.

Thank you for your fast reply. I have done that ... I have put "None" instead of "Not yet started" just to check. But I am not getting the point.

According to the program, the method run() will be executed when I said cs1.start().

After the method run() have been executed, the value of the serverStatus should be either "ON" or "OFF" (see inside the while loop in the class Server)but still i am getting "Not yet started". Its like the method run() not running at all. I tried to put the setServerStatus("Test") outside the while-loop but i am still getting "Not Yet Started".

I could not figure whats wrong with my code. Many thanks in advance.

In your code, you set the status to ON or OFF when you process a connection from the client. Without a client to connect, those statuses will never get set, because the run() method will never get past the ss.accept(). Remember, the accept() method will just sit there waiting until there is a connection. Maybe try setting the status to "waiting for first connection" in the run() method just BEFORE the ss.accept()

I have done this but its not working, even if i put the setServerStatus just after "try":

public void run(){
try{
setServerStatus("Waiting for client connection...");

When I put the getServerStatus before the "try" its working, once inside the try, I get the "Not Yet Started". Do you think it has something to do with the tread ?

Sorry, don't know. Did you put the printStackTrace() in the catch like I said before? Try putting a few System.out.println("step 1 (2,3,4)"); statements into your run method so you can see exactly where it's getting to.
Try making a connection and see what happens. Just type
http://localhost:5000/ into your web browser. It won't do anything useful, but your code should accept the connection and echo the HTTP request for you.

Thanks, yeah I have put the printStackTrace() and i got this while running the program.

java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:141)
at ignisv4.Server.run(Server.java:43)

When I clicked the button again, i got
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:141)
at ignisv4.Server.run(Server.java:43)

Anyway, thanks a lot, if its not working I will start all from scratch again.

NO don't give up now! You're almost there!
The exception is caused because previous test runs failed to close the socket properly and so it looks like it's still in use next time you try to open it. For as quick and dirty fix change the socket address to 5001, and keep changing it each time you get this problem. Fix it properly when your code is working a bit better. DON'T GIVE UP.

Comments
Good advice. You have been very helpful in this thread.

Hello,
Thank you very much for your help. I have done the Client part but I can't get it to work. After running the server, i click connect on the client .. but then the client freeze as first time.

Then, again I have tried using Thread on the client also(as you suggest earlier) but after using Thread, afterwards nothing happen to the program. I have removed the Thread for the client side, here is a copy of the codes, check it please. Hope you will find a solution to my problem, thanks a lot for your precious time and help.

Attachments
package ignisv5;

import java.io.*;
import java.net.*;
import javax.swing.JOptionPane;


public class Client{

    Socket clientSocket = null;
    PrintWriter output = null;
    BufferedReader input = null;
    String clientMessage;
    String messageFromServer;
    String clientStatus = "Not Yet Started";


public String getClientStatus(){
     return clientStatus;
 }

 public void setClientStatus(String status){
     clientStatus = status;
 }


public void createClient(){
    try{

    Socket clientSocket = new Socket("localhost",1234);
    setClientStatus("Connected to server");
    //Communicating with the server
    BufferedReader input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    PrintWriter output = new PrintWriter(clientSocket.getOutputStream(), true /* autoFlush */);




    //this code: the client just waits for the data sent by the server
    boolean more = true;
    while (more)
    {
        String line = input.readLine();
        if (line == null)
          more = false;
        else

           //System.out.println(line);
           messageFromServer = line;
           JOptionPane.showMessageDialog(null, messageFromServer);
    }

    }catch(Exception e){e.printStackTrace();}
}


}
package ignisv5;

public class ClientConnect extends javax.swing.JFrame {

    /** Creates new form ClientConnect */
    public ClientConnect() {
        initComponents();
    }


    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        txtConnect2Server = new javax.swing.JButton();
        txtSendMessage = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        btnSendMessage = new javax.swing.JButton();
        txtClientStatus = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("iGnis Client");

        txtConnect2Server.setText("Connect 2 Server");
        txtConnect2Server.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtConnect2ServerActionPerformed(evt);
            }
        });

        jLabel1.setText("Message");

        btnSendMessage.setText("Send");
        btnSendMessage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSendMessageActionPerformed(evt);
            }
        });

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(txtConnect2Server)
                        .addGap(31, 31, 31)
                        .addComponent(txtClientStatus))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(txtSendMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnSendMessage)))
                .addContainerGap(41, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtConnect2Server)
                    .addComponent(txtClientStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSendMessage)
                    .addComponent(txtSendMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-432)/2, (screenSize.height-376)/2, 432, 376);
    }// </editor-fold>//GEN-END:initComponents

    private void txtConnect2ServerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtConnect2ServerActionPerformed
            Client cc1 = new Client();
            cc1.createClient();
            txtClientStatus.setText(cc1.getClientStatus()); 
    }//GEN-LAST:event_txtConnect2ServerActionPerformed

    private void btnSendMessageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSendMessageActionPerformed

    }//GEN-LAST:event_btnSendMessageActionPerformed

   
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ClientConnect().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnSendMessage;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField txtClientStatus;
    private javax.swing.JButton txtConnect2Server;
    private javax.swing.JTextField txtSendMessage;
    // End of variables declaration//GEN-END:variables

}
package ignisv5;


import java.io.*;
import java.net.*;


public class Server extends Thread {

 int portNumber = 1234;
 String serverStatus = "Not yet started";

 Socket serverSocket = null;
 PrintWriter output = null;
 BufferedReader input = null;

 public void setPortNumber(int PN){
        this.portNumber = PN;
 }
 
 public int getPortNumber(){
     return portNumber;
 }

 public String getServerStatus(){
     return serverStatus;
 }

 public void setServerStatus(String status){
     serverStatus = status;
 }

 public void run(){

      

     try{
        ServerSocket serverSocket = new ServerSocket(portNumber);
        //created server socket to listen indefinitely and accept incoming requests. This is done by using the accept() method of ServerSocket class. When a request comes, accept() returns a Socket object representing the connection. In code it would be:
        setServerStatus("Waiting for client connection...");
        Socket incoming = serverSocket.accept();
        //InputStream incomingStream = new InputStream();
        //incomingStream = incoming.getInputStream();
        setServerStatus("Connection accepted...");
        BufferedReader input = new BufferedReader  (new InputStreamReader(incoming.getInputStream()));
        PrintWriter output = new PrintWriter  (incoming.getOutputStream(), true /* autoFlush */);

        boolean done = false;
        while (!done)
        {
          String messageline = input.readLine();
          if (messageline == null){
              done = true;
              setServerStatus("OFF");
          }
          else
          {
            output.println("Echo: " + messageline);
              setServerStatus("ON");
          }

          if (messageline.trim().equals("BYE")){
              done = true;
              setServerStatus("OFF ... Terminated by client.");
          }
        }

        incoming.close();

     }catch(Exception e){e.printStackTrace();}

 }





}
package ignisv5;
public class ServerConnect extends javax.swing.JFrame {

    /** Creates new form ServerConnect */
    public ServerConnect() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnServerOn = new javax.swing.JButton();
        txtServerStatus = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        btnSSendData = new javax.swing.JButton();
        txtMessage = new javax.swing.JTextField();
        lblMessage = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtadisplay = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("iGnis Server");

        btnServerOn.setText("Server On");
        btnServerOn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnServerOnActionPerformed(evt);
            }
        });

        jLabel1.setText("Server Status");

        btnSSendData.setText("Send");
        btnSSendData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSSendDataActionPerformed(evt);
            }
        });

        lblMessage.setText("Message");

        txtadisplay.setColumns(20);
        txtadisplay.setRows(5);
        jScrollPane1.setViewportView(txtadisplay);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(btnServerOn)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtServerStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lblMessage)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnSSendData)))
                .addGap(31, 31, 31))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnServerOn)
                    .addComponent(jLabel1)
                    .addComponent(txtServerStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblMessage)
                    .addComponent(btnSSendData)
                    .addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnServerOnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnServerOnActionPerformed

        Server cs1 = new Server();
        cs1.start();
        txtServerStatus.setText("Status: " + cs1.getServerStatus());
         


    }//GEN-LAST:event_btnServerOnActionPerformed

    private void btnSSendDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSSendDataActionPerformed
       String message = txtMessage.getText();

    }//GEN-LAST:event_btnSSendDataActionPerformed


    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ServerConnect().setVisible(true);
            
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnSSendData;
    private javax.swing.JButton btnServerOn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblMessage;
    private javax.swing.JTextField txtMessage;
    private javax.swing.JTextField txtServerStatus;
    private javax.swing.JTextArea txtadisplay;
    // End of variables declaration//GEN-END:variables

}

Is the server receiving the connection request?
Did you try using your browser as I suggested to check that the server is working properly?
The server waits for a line of input from the client before it sends its response, but the client code never sends one, so the server never responds, and the client waits forever.

Yes .. I have. When running localhost with the port 1234 and with the server supposedly "ON", I got "This webpage is not available.". I try to change the port every time but still don't know what to do.

You know, I am still learning thats why you may found silly mistakes in my codes(I am working hard on it to make it work .. I am developing it bit by bit to understand socket programming well), if their are some mistakes could you please correct it for me. Sometimes i got confuse. I am with these codes since monday.

Btw, could you explain to me how to write to the server from the client using the "PrintWriter output".

Thanks James.

could you explain to me how to write to the server from the client using the "PrintWriter output".
.

Same code as server sending to client, but other way round!

Did you add the System..printlines as I suggested to see whether the server gets the connection request?

Yeah ... I have put it but can't understand if its working or not. I am confuse, its seems to enter the while loop but the getServerStatus not working. I can't find the logic in it. Please do you have any other suggestions ?

OK, break the problem down into small pieces and fix them one at a time. I suggest you leave the whole GUI thing alone until the server and client code are working. Hard-code calls to the server & client code, and use System.out to see what's happening. When it all works properly, add in the user interface.
If your server code is entering the while loop then the connection HAS been made, so you're doing well. You still probably have the problem I described in my last post - so either get the client vto send something to the server, or simplify the server so it sends a response without waiting for the client to send something.
OK, it's now time for pre-dinner drinks here in France, so I'm going to sign off until tomorrow. Good luck, and remember - one thing at a time!

Comments
A lot of patient help in this thread.

Ok .. Thanks a lot for your help. I will continue to work on it till morning !! Hope tomorrow I will be able to solve the problem by myself. If not i will post tomorrow. Again thank you very much for you time... this forum really rocks !! A+

This question has already been answered. Start a new discussion instead.