This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Echo client/server application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Echo client/server application" Watch "Echo client/server application" New topic
Author

Echo client/server application

Roger Fed
Ranch Hand

Joined: Oct 17, 2010
Posts: 82

Hello,
I've developed two classes for Echo client/server apllication
the server class works well but when i try to run the client class it flags me two errors
This is the client class

when i write this command in command prompt:javac TCPEchoClient.java
it flags me these two errors:
TCPEchoClient.java:5: <identifier> expected
private static InetAddre
^
TCPEchoClient.java:7: reached end of file while parsing
}
^
2 errors

How can i get rid of these two errors?
thanks in advance...........


I Hear I Forget, I See I Remember, I Do I Understand.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18509
    
  40

Roger Fed wrote:
when i write this command in command prompt:javac TCPEchoClient.java
it flags me these two errors:
TCPEchoClient.java:5: <identifier> expected
private static InetAddre
^
TCPEchoClient.java:7: reached end of file while parsing
}
^
2 errors

How can i get rid of these two errors?
thanks in advance...........


Are you saving the file and compiling at the exact same time? Or using some sort of autosave?

According to the messages, the compiler is only seeing a file that is 7 lines long. And clearly not the text that your shown here.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Do not use println in combination with sockets. Always use an explicit \n or \r\n, depending on your needs. If you don't your code may stop working if you move it from one machine to another.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Echo client/server application
 
Similar Threads
sockets: How to receive server response in client
Connection Refused Error
Help Debugging my TCP client server program to solve the producer consumer problem
Application Client-Server and stream
not able to connect...