This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes sending my name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

sending my name

Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
public class KnockKnockClient
public static void main(String[] args) throws IOException
Socket kkSocket = null;
PrintWriter out = null;
kkSocket = new Socket("taranis", 4444);
out = new PrintWriter(kkSocket.getOutputStream(), true);
catch (UnknownHostException e)
System.err.println("Don't know about host: taranis.");
catch (IOException e)
System.err.println("Couldn't get I/O for the connection to:
String fromUser = new String("Lucky Singh");;
while ((fromUser = in.readLine()) != null)
if (fromUser != null)
Is the aboev code correct for sending my name to a server?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

Please don't cross-post. Finish the conversation you started here.

[Jess in Action][AskingGoodQuestions]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: sending my name
It's not a secret anymore!