-
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.
-
Can you tell us what the error message is please.
-
Remember to close the socket
Arul
Similar Threads
-
Replies: 2
Last Post: 04-18-2007, 02:34 AM
-
By Nitya in forum ASP.NET
Replies: 2
Last Post: 07-30-2006, 07:43 AM
-
By Calderara Serge in forum Enterprise
Replies: 1
Last Post: 07-24-2002, 12:40 AM
-
By Ramdas in forum Database
Replies: 0
Last Post: 05-16-2001, 02:57 PM
-
Replies: 2
Last Post: 04-20-2000, 08:12 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks