I got Cannot resolve symbol 'dis_tunnel1' this error in following code. This code is for implementing of socket programming using threading. In this socket programming server can send two thing date and time to client. If client type Date then server sent Date to client and also if client type Time then server sent Time as like date. But In my programming Cannot resolve symbol 'dis_tunnel1' this error
public class ClientHandler extends Thread {
DateFormat fordate = new SimpleDateFormat("DD/MM/YYYY");
DateFormat fortime = new SimpleDateFormat("hh:mm:ss");
final Socket com_tunnel1;
final DataInputStream dis_tunnel1;
final DataOutputStream dos_tunnel1;
String received = "";
String toreturn = "";
public ClientHandler(Socket s, DataInputStream dis, DataOutputStream dos) {
this.com_tunnel1 = s;
this.dis_tunnel1 = dis;
this.dos_tunnel1 = dos;
}
public void run() {
while (true) {
try {
dos_tunnel1.writeUTF("What do you want [Date/Time");
received.dis_tunnel1.read_UTF();
if (received.equals("Exit")) {
System.out.println("Client " + this.com_tunnel1 + " send exits..");
System.out.println("Closing the connections");
this.com_tunnel1.close();
break;
}
Date date = new Date();
switch (received) {
case "Date":
toreturn = fordate.format(date);
dos_tunnel1.writeUTF(toreturn);
break;
case "Time":
toreturn = fortime.format(date);
dos_tunnel1.writeUTF(toreturn);
break;
default:
dos_tunnel1.writeUTF("Invalid input");
break;
}
} catch (IOException e) {
Logger.getLogger(ClientHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
try {
this.dos_tunnel1.close();
this.dis_tunnel1.close();
} catch (IOException e) {
Logger.getLogger(ClientHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
}