java - Having problems with .getInputStream() -
i trying program tcp chat server, having difficulties .getinputstream() , .getoutputstream() methods, compiler says "cannot find symbol- method .getinputstream(). here code, have not progressed far yet:
import java.net.*; import java.io.*; public class server { public static void server (string[] args) { serversocket ss1 = null; dataoutputstream dos1 = null; datainputstream dis1 = null; //setting values null try { ss1 = new serversocket(5000); //setting socket ss1 port 5000 , creating instance socket clientsocket = ss1.accept(); //accepting connection request dos1 = new dataoutputstream(ss1.getoutputstream()); dis1 = new datainputstream(ss1.getinputstream()); //creating output , input streams } catch (exception e){ system.err.println("error!"); } } }
i using bluej on windows 7, if that's problem. also, can't seem find explanations how data streams or "old-school" sockets work, if knows can those, it'd appreciated. :)
~alon.
you have call:
clientsocket.getoutputstream() clientsocket.getinputstream()
inside dataoutput-/datainputstream constructors.
Comments
Post a Comment