tcp server using pthreads is not working...ne help plz?
Hi,
I am new to using threads in C++ though I have been wkring on C++ for past 1.5 years...I want to write a TCP server that serves multiple client connections...to start off..i have been working on a simple tcp echo server trying to understand how threads work....
this is my server code:
But the server is behaving in a strange manner..It is able to handle just one client at a time. When i connect multiple clients to it, only the last connection gets the echo..as for the rest...the connections are neither closed nor the messages are echoed...the client just stalls!
One more observation....the last message given by previous client is echoed to the latest connection (i.e to the latest client)...and then no more echoes to the previous client..
Am i missing something here? ne help is highly appreciated...
I have modified your code so that it works. In addition I removed the pthread_create() call by replacing it with a PTHREAD_CREATE_DETACHED attribute in pthread_create.
I have problem with oracle solaris 10 running on oracle sparc T4-2 server.
Os information: 5.10 Generic_150400-03 sun4v sparc sun4v
Output from tcpstat.d script
TCP bytes: out outRetrans in inDup inUnorder
6833763 7300 98884 0... (2 Replies)
Hi,
I am having a solaris server. I want to start a dummy TCP listner on UNIX OS on a specific port can anyone please let me know the process.
IP ADDRESS: 123.123.123.123
Port: 8010 (1 Reply)
I made a program and now I need to make it concurrent.
Can someone pls help me do this ?
The code is this:
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>... (4 Replies)
Hello @ all,
I hope you can give me some advice :b:
I will be following code for a tcp server and doStuff () function, the
clients treated. From some point, I have several identical
clients (zombies, I think), the same records in the database
write. Has anyone an explanation? What can I... (1 Reply)
We have a NAS application which can be accessed by both HTTP and HTTPS connections.
The issue we are facing is that the tcp server instance that initiates the HTTP access dies after a few hours of inactivity(the NAS application was kept idle for around 10 hours). However, the tcpserver that... (1 Reply)
Helo ..
How Can i Hide My Server Type Here
Hostpres.com - Host Pres
And writing Secureb By ....
And how Can i Hide uname -a: Linux server.xxxx.net 2.6.18-ovz028stab053.14-enterprise #1 SMP Mon Jun 2 18:25:30 MSD
2008 i686
From Php Shell Like c99... (3 Replies)
I have true64 Unix running and there a scales in the sytem which connect thru a com-server to the network. they have their own IP-address and are communicating over port 8000. when I telnet to the com-servers and the print function of the scale is executed I can see the data coming.
I need to know... (1 Reply)
I am trying to writa a multi-client & multi-threaded TCP server.
There is a thread pool. Each thread in the pool will handle
requests of multiple clients.
But here I have a problem. I find a solution but it is not how
it must be... i think. When threads working without sleep(1)
I can't... (0 Replies)
i am programming a tcp_ip server which intends to listen permanently to a client . the client can disconnect and connect again and the server accept it(by this point it works).The problem is when the client lose connection without a disconnect command and my code can't get it and keeps waiting for... (4 Replies)