Hi,
I have a problem in creating a client server program in java. Here is my source code. Check the code and see if you could help me.
Code:
Public class hand {
Public static void hand(String args[]) {
System.out.print("Welcome ");
try {
sc = new Socket("127.0.0.1",8080);
}
catch(Exception e) {
System.out.print("Error opening sc");
}
scn = new Scanner(System.in);
try {
out = new PrintWriter(sc.getOutputStream(),true);
} catch (Exception e) {
System.out.print("Error creating outflow");
}
System.out.print("Variable initialized: waiting for input ...");
String str;
while(true) {
str = scn.nextLine();
out.System.out.println(str);
}
}
private static Socket sc;
private static Scanner scn;
private static PrintWriter out;
}
This is my client program and similar to this is my server program, but I am getting an error while compiling the code.
Bookmarks