wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Please find the problem in this code. 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 "Please find the problem in this code." Watch "Please find the problem in this code." New topic
Author

Please find the problem in this code.

Ajay Xavier
Ranch Hand

Joined: Jan 03, 2005
Posts: 109
hi,

I am a beginner in socket programming. I wrote a sample program to echo the contents received from the client.

server program:

This programs opens a server socket and waits for client connection. "testThread" is used to serve multiple clients. For each client a seperate thread is spawn to echo the contents. The code for that thread is


The client program is
there will be many clients like this.

Running this code produces the following output
for Server


for client


Once the data is written at the client side the server is not picking this data and echoing it back.

Please identify where the problem is .
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and a last name.

You can edit your name here.

Thank you for your prompt attention, and enjoy the ranch!

Layne


Java API Documentation
The Java Tutorial
 
Don't get me started about those stupid light bulbs.
 
subject: Please find the problem in this code.
 
Similar Threads
Java Head First Client Server Example
Sending text over socket help!!
Client doesn't get output when local address is replaced by server address
java networking, hangs at readline()
Simple Chat Problem