Stuard
January 7th, 2003, 02:58 PM
I create multithread application and in each thread create socket to connect to some port of local server. Each thread contain something like this:
{
s = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
...
d = connect(s, (struct sockaddr *)&a, sizeof(a));
...
closesocket(d);
}
After about 4000 sequential calling this thread (max 100 threads active at a time!) connect function start returning error code 10055(No buffer space available).
WHY?
After termination each thread I call closesocket(...) but it seams that closesocket doesn't reallocate taken resource!
If I call inside thread just socket(...) function but not connect then works fine .(that means connect(...) has some problem!)
Any help would be appreciated!
Thanks.
{
s = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
...
d = connect(s, (struct sockaddr *)&a, sizeof(a));
...
closesocket(d);
}
After about 4000 sequential calling this thread (max 100 threads active at a time!) connect function start returning error code 10055(No buffer space available).
WHY?
After termination each thread I call closesocket(...) but it seams that closesocket doesn't reallocate taken resource!
If I call inside thread just socket(...) function but not connect then works fine .(that means connect(...) has some problem!)
Any help would be appreciated!
Thanks.