i am new to java networking. my client program is giving an error"Couldn't get I/O for the connection to:192.168.1.2"
in the below program.will u please help me.and 192.168.1.2 this is my local machine.
code:
import java.io.*;
import java.net.*;
public class client1 {
public static void main(String[] args) throws IOException {
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket("192.168.1.2", 32133);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: taranis.");
System.exit(1);
}catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to:192.168.1.2");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}