Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

My first client server app lil help please

Options
  • 22-11-2006 7:19pm
    #1
    Registered Users Posts: 221 ✭✭


    I'm writing a client server in java . I'm really used to it so i'm having alittle trouble.

    The problem is i've got a string which i want to send from the client to the server.
    Here's what im doing :

    Client side :
    PrintWriter writer = new PrintWriter(skt.getOutPutStream());
    writer.println(Pick);

    note this is where skt is a Socket and Pick is a String.

    On the Server side i have this :
    try{

    InputStreamReader stream = new InputStreamReader(theConnection.getInputStream());
    BufferedReader reader = new BufferedReader(stream);
    System.out.println("readline is :" + reader.readLine());

    NewPick = reader.readLine();


    }catch(IOException e){
    System.out.println("Didn't get into try to read");

    }

    In this case THis code is within a run method for a thread . theCOnnection is a Socket and NewPick is a string. I'm 90% sure the problem is with the reader.readLine.


    Can anyone shed some light ??


    Thanks a million

    -Elfman


Advertisement