| Author |
Problem with a messenger app: only one line is sent to remote address
|
Octavian Miu
Greenhorn
Joined: May 22, 2009
Posts: 8
|
|
the server part is ok, when i am using telnet command i get in the app all the lines sent, but when i trying to sent from the app to app jus one line is catched by the app. Here is my client code. Please tell me what i m doing wrong:
public static void openClientSocket(String serverIP, MainWindow mainWindow) {
java.net.Socket clientSocket = null;
java.io.PrintWriter pw = null;
try {
clientSocket = new java.net.Socket(serverIP, 9995);
pw = new java.io.PrintWriter(clientSocket.getOutputStream());
pw.println(mainWindow.mainPanel.dialogPanel.inputField.getText());
pw.close();
clientSocket.close();
} catch (Throwable t) { System.out.println("Error " + t.getMessage());}
}
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8259
|
|
Welcome to the JavaRanch.
One common mistake is using println on a socket.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
 |
|
|
subject: Problem with a messenger app: only one line is sent to remote address
|
|
|