• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please find the problem in this code.

 
Ajay Xavier
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic