Re: C++ threads, sockets
- From: "Michael K. O'Neill" <mikeathon2000@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 May 2007 22:55:54 -0800
"verdverm" <verdverm@xxxxxxxxx> wrote in message
news:1176196710.926318.200210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 4, 7:39 am, "Maxim Yegorushkin" <maxim.yegorush...@xxxxxxxxx>
wrote:
On 4 Apr, 00:38, "verdverm" <verdv...@xxxxxxxxx> wrote:
I havd tried the posix threads with multiple socket clients making
high rate requests and they start hanging (always in socket::recv()
like waiting for incoming data? ), not all at the same time, and not
always all of them.
Do you mean that for each accept()ed connection it creates a thread to
serve the connection?
Not sure if its a thread memory problem or a problem with the TCP
handshake
The threads have access to a global static vector and make ~25 GET
http requests per minute
gcc 4.1 / kernel 2.6.20 / basically most recent stable releases
Thoughts...? recomendatiions, more info...?
Try running it under strace to get more info.
haven't gotten a chance to try anything out, but its more like
create 10 threads
thread func {
Socket s; // and init
s.connect
s.send( "GET ..." ); a .csv file
string data
while( s.recv(buf) )
data+= buf;
process data
write data to disk
}
the idea was to learn about threads and take advantage of the idle
time
while trying to increase the # of GETs per minute
If recv() is hanging, there might be a problem in your GET request. Are you
using HTTP/1.0 or 1.1? You should use 1.0, or else the server will maintain
a persistent connection (i.e., keep the connection open), and recv() will
hang because the connection has not been closed.
Mike
.
- Prev by Date: Re: Boolean Buyers Beware ... AIX compiler bug --- PMR 26241,756
- Next by Date: Re: can someone explain memory barriers (singletons)
- Previous by thread: can someone explain memory barriers (singletons)
- Next by thread: How do I get my threaded program to run on both CPU's of my Opteron?
- Index(es):
Relevant Pages
|