DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    2

    Help wanted on Client-Server

    I'm in the early stages of writing a client-server program. I've got the client and the server communicating (I think). I send text from the client to the server. I then want the server side BufferedReader
    in

    to be read into a variable. I've tried doing it using
    String inputLine = in.readLine()

    but it keeps throwing an IOException. I can't work out why.


    try {
    PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
    BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    System.out.println("The printwriter and bufferedreader have been set up.");
    String inputLine, outputLine;
    inputLine = in.readLine();
    System.out.println(inputLine);
    } catch (IOException e) {
    System.out.println(e);
    }



    The serverSocket and socket have been set up properly as far as I can tell. It's just the above portion of code that seems to be causing a problem. My knowledge of Java is fairly basic at the moment, so any help would be greatly appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    UK, London
    Posts
    150
    Can you tell us what the error message is please.

  3. #3
    Join Date
    Jan 2006
    Location
    Sydney
    Posts
    49

    Remember to close the socket

    Arul

Similar Threads

  1. Replies: 2
    Last Post: 04-18-2007, 02:34 AM
  2. Replies: 2
    Last Post: 07-30-2006, 07:43 AM
  3. Client server communication with Winsock
    By Calderara Serge in forum Enterprise
    Replies: 1
    Last Post: 07-24-2002, 12:40 AM
  4. Microsoft Sql Server 2000 Client DLL
    By Ramdas in forum Database
    Replies: 0
    Last Post: 05-16-2001, 02:57 PM
  5. Combine Client Side & Server Side?
    By Jeff in forum ASP.NET
    Replies: 2
    Last Post: 04-20-2000, 08:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links