hey guys i m new to
java programming. i have jdk1.6. i started on socket programming. here is the code for it
server side:
import java.io.*;
import java.net.*;
class server
{
public static void main(
String[] args)
{
ServerSocket ss=new ServerSocket(5000);
Socket soc1=ss.accept();
DataInputStream in=new DataInputStream(soc1.getInputStream());
DataOutputStream out=new DataOutputStream(soc1.getOutputStream());
String msg=soc1.readUTF();
System.out.println(msg);
soc1.writeUTF("I received");
msg=soc1.readUTF();
soc1.close();
}
}
client side:
import java.io.*;
import java.net.*;
class client
{
public static void main(String[] args)
{
Socket soc=new Socket("192.168.1.2",5000);
DataInputStream in1=new DataInputStream(soc.getInputStream());
DataOutputStream out1=new DataOutputStream(soc.getOutputStream());
String mes="hi";
soc.writeUTF(mes);
String msg1=soc.readUTF();
soc.writeUTF("Bye");
soc.close();
}
}
i got the errors in read and write utf saying that cannot find the symbol. is my program correct or do i need an additional software along with jdk to run this kind of program.
p.s: this is a part of my project. so any help wil be highly appreciated... thank ya..