I how another question

I ran a program with one client and one server.
it works correctly .but when I have a multiClient program ,the serverThread can not read the sentence from client .why it can't do this?is that because of extending thread

I know that client class sends the sentence but the server can not read that .what should I do?

please help me

Recommended Answers

All 4 Replies

First of all, try to make your sentences more clear so I can understand. Secondly, are you sure the client has established a connection?

I how another question

I ran a program with one client and one server.
it works correctly .but when I have a multiClient program ,the serverThread can not read the sentence from client .why it can't do this?is that because of extending thread

I know that client class sends the sentence but the server can not read that .what should I do?

please help me

Please do ask question in bit more detail. We can't get the design of program you are making with these sentences.

There are a bit things that you can check. First of all make sure that each client is establishing the connectionwith server.

A better approach is to open connection with each client in separate thread. i.e if there are 3 clients connected to server, server must be running 3 threads to listen from these clients.

well.. did u put while(true) ??

thanks all
I opened a new thread for each client and put a while (true) .now my program works correctly
thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.