Search code examples
socketscompiler-errorssyntax-errorserversocket

Can someone improve my code? what's wrong?


I have a problem in compiling, it's a "unexpected type required variable; found: value" and "incopatible types" my code is here:

`

String sCL;
BufferedReader br = null;
br = new BufferedReader(new FileReader("banned.txt"));
providerSocket = new ServerSocket(2004, 10);
connection = providerSocket.accept();

`

while((sCL = br.readLine()) != null) {
    if ((br.readLine()) = (connection.getInetAddress().getHostName())) {
        sendMessage("baned");
    }
    else {
    //some code here.
    }
}

Errors are in .readLine() and .getHostName()


Solution

  • Did you need a double-equals here?:

    if ((br.readLine()) == (...