File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes How can i Pass String in to Socket .....Urgent..urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How can i Pass String in to Socket .....Urgent..urgent " Watch "How can i Pass String in to Socket .....Urgent..urgent " New topic

How can i Pass String in to Socket .....Urgent..urgent

Deepak B

Joined: Jun 19, 2001
Posts: 17
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 �
sushant sawant

Joined: Apr 28, 2001
Posts: 3
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
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.
thanks 4 thanks
Deepak B

Joined: Jun 19, 2001
Posts: 17
Thnx sushant
I got it
I agree. Here's the link:
subject: How can i Pass String in to Socket .....Urgent..urgent
Similar Threads
URGENT!! chat applet
urgent help
Urgent help on Chat Program