I am practicing networking in java, and I intend to send a file via SocketChannel, with the host and port specified by the user. However when I declare the variables Eclipse gives the error message:
"Syntax error on tokes, delete these tokens" EDIT: (This error message pops up next to the declarations of port and host)
This is my code:
public int port;
public String host;
public class Client {
public static void main (String[] args) {
System.out.print("Enter host/ip: ");
Scanner inputHost = new Scanner(System.in);
host = inputHost.next();
System.out.print("Enter port: ");
Scanner inputPort = new Scanner(System.in);
port = inputPort.nextInt();
Client client = new Client();
SocketChannel channel = client.createChannel();
client.sendFile(channel);