this first time using socket client server system. i'm running error server side of system , not know coming from. client running fine , closing server function
public void run() throws exception { serversocket srvsck = new serversocket(444); socket sock = srvsck.accept(); string message=""; inputstreamreader ir = new inputstreamreader(sock.getinputstream()); bufferedreader br = new bufferedreader(ir); message = br.readline(); while(message!="exit"){ system.out.println(message); message = br.readline(); } srvsck.close(); sock.close(); system.out.println("here"); }
but error i'm getting. doesn't out while loop. i've tried breaking out loop based on value of message doesn't. , can't figure out why. i've checked thread , nothing seems same. if matters information client coming file.
first of all, should stick java naming conventions of starting lowercase variable names. next, when comparing strings, don't use :
string1 == string2 string1 != string2
those won't work. instead, use
string1.equals(string2)
Comments
Post a Comment