This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

Please find the problem in this code.

Ajay Xavier
Ranch Hand

Joined: Jan 03, 2005
Posts: 109

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!


Java API Documentation
The Java Tutorial
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Please find the problem in this code.
It's not a secret anymore!