java - Socket clientSocket = serverSocket.accept(); cannot be resolved -
java - Socket clientSocket = serverSocket.accept(); cannot be resolved -
after years of creating small- medium-scale flash games (and little java command-line apps), i'm ready introduce myself world of sockets :). i'm pretty sure i've grasped decent understanding can't work out why wont work... seems work everywhere else i've seen it.
try { serversocket serversocket = new serversocket(6644); } grab (ioexception e) { e.printstacktrace(); } while(true){ socket clientsocket = serversocket.accept(); }
eclipse keeps telling me 'cannot resolved' when hover mouse on serversocket on clientsocket = serversocket.accept();
line. variable exists , there isn't typo what's matter?
i've imported java.io.*
, java.net.*
i'm pretty sure have need.
your serversocket
variable visible within try
block. move declaration outside, maybe this:
serversocket serversocket = null; seek { serversocket = new serversocket(6644); } grab (ioexception e) { e.printstacktrace(); } while(true){ socket clientsocket = serversocket.accept(); }
java eclipse sockets serversocket server
Comments
Post a Comment