How can i Pass String in to Socket .....Urgent..urgent
Deepak B
Greenhorn
Joined: Jun 19, 2001
Posts: 17
posted
0
Dear friends I am trying to make chat server application but I am facing problem � How can pass a user name(string) to server . I made a client socket with make a TCP/IP connection to server using Socket s=new socket(host , port); Actually my aim is to broadcast username to all user who currently login..Means as user login message will be display on the screen like �Denial has joined Room� here Denial is user name it may be differ .. Another thing is that I want to online user list in to applet that is only possible when I get username when new client connect to server. I tried all the client socket option��plz help its urgent �. Thnx in advance � Deep
sushant sawant
Greenhorn
Joined: Apr 28, 2001
Posts: 3
posted
0
theSocket=new Socket(e.inet,thePort); in=new BufferedReader(new InputStreamReader(theSocket.getInputStream())); out=new PrintWriter(new OutputStreamWriter(theSocket.getOutputStream()),true) create input and oupput stream like this and then get ur username from textfield like uname=tf1.getText(); and then send it to server with some initial string before it so server can understand that it is username like and get username from tht i think this much is enough. out.println("#"+uname); thanks 4 thanks