aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes new to socket programming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "new to socket programming" Watch "new to socket programming" New topic
Author

new to socket programming

ambrositti li
Greenhorn

Joined: Apr 12, 2004
Posts: 2
Hi, folks. Here is the partial spec of my first networking programming assignment.
GET: This message is sent from the client to the server, and contains the ASCII string GET followed by the newline character \n. On sending the GET message, the client waits for a return message from the server via the socket that connects them.
eg.
Client: GET
Server: GET: OK
A dog says woof
however, what i've got from the command line is like this:
Server: GET: OK
you see, the rest of the message(after the newline character) is missing. Could someone plz point me out what i did wrong. Thanx in advance.
below is the complete four classes i've come up so far and the text file(animalSoundData.txt) the server reads. it's all complied. please copy it to your own HDD and run it so you would know exactly what the problem is. thanx again!
P.S. i am sorry about the long post. please bear with me as i am desperately looking for the solution.
the server class

the client class

the protocol class

the helper class

the content of text(animalSoundData.txt)file:
dog:woof
cat:miao
cow:moo
snake:hiss
bird:chirp
[ April 12, 2004: Message edited by: ambrositti li ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
In the client, double check what's inside the loop "while((userInput = stdIn.readLine()) != null)" and what should maybe be outside the loop. That's a broad hint at one thing that may not actually be the problem. Lemme know if it helped!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
wood burning stoves
 
subject: new to socket programming