Multiple Client/Server Chat server(Using threads)

Multiple Client/Server Chat server(Using threads)

Post by Sood » Wed, 13 Nov 2002 14:49:22



Hallo All,
I have been breaking my head over a problem with my program.  I am
using stream socket programming on UNIX Sun solaris.  I have a server
that let multiple client connections using multi-threading.  There are
separate threads for each client.  I ran into the following problem.

When two (or more clients) connect to the server, I am using the send
function to transfer message to the server.  When the first client is
connected, the send/recv function from the client to server works just
fine.  Likewise, the send/recv function from the server to the client
works fine.  For example, the first client "logs in with username &
password" which is sent to the server for verification.  The server
verifies it and sends an "OK" back to the client.  In my program, I
send a character "1" indicating the username and password mathces.  At
this point in time, the value in the "buf" received by the recv
function in the client is correct.

However, when the second client connects, a second thread is started.
When the second client tries to log in the same way the first client
did, the client side correctly sends the username/password information
to the server (just like the it happened in the first client).   After
the server verifies it, the server uses "send" to send the buffer back
to the client.  On the client side, the "recv" function which should
have worked the same way as in the first client, does not receive the
character sent from the server.  The recv function is empty instead.

I am not sure what is going on.  Can someone please send me
suggestions as to how to overcome this problem.

Thanks
SA

 
 
 

Multiple Client/Server Chat server(Using threads)

Post by David Schwart » Thu, 14 Nov 2002 03:01:49



> The recv function is empty instead.

        What does that mean? How can a function be empty?

        DS

 
 
 

1. Connecting two machines:; Client only communicate with server when server continuously pings client.

Server:
Linux 2.0.29
Smc Etherez 8149
Loadable module for smc ultra v2.00
Crossover wires or smc hub and store bought cables
No Dns
No Error messages on boot up
No Error messages in logs
No problems networking locally in the server
No problem pinging the client (Linux/win)

Client:
Linux 2.0.29/Win
3com etherlink3 lan+33.6 3C562D/3C563D (pcmcia)
Pcmcia Card Services v2.9.2 or higher to version that supports the card
specifically.
No Dns
No Error messages on boot up
No Error messages in logs
No problems networking locally in the client

Problem:
Unless the Server is continuously pinging clients ip # ,
the client will comunicate with the server for a few moments, then stop.
Once I start pinging the client from the server they communicate fine.

When I run both machines in win with NetBEUI, it runs as smooth as silk.

Thanks Harley


2. HP XU 6/200 problem with Ultra SCSI and Linux 2.0

3. Sex Change - Making Server as Client and Client as Server

4. lost if firewall land

5. PopTop VPN Server can see Win98 client but client can't see server

6. yesterday's date?

7. Communication needed between linux server/client to windows client/server

8. Traffic routing for Multiple Web & Mail Servers behind a single linux firewall

9. Wanted: Fax Server/client for 95 clients w/ Linux server

10. Using your web server as a file server/version control server?

11. Client to connect to a chat server

12. ??:Anyone Know Of A Cross Platform/OS Audio Chat/Talk Client/Server??

13. chat server + client -> "minimum"