Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

My first client server app lil help please

  • 22-11-2006 07:19PM
    #1
    Registered Users, Registered Users 2 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