Socket fds shoots up (Socket programming)
Kindly give some ideas related to the following issue
I am creating 3 processes, P1, P2,P3 and P4
P1 => has a server socket and a client
P2 => client (socket)of P1 (creates only one socket with P1)
P3 => client (socket) of P1 (dynamically creates a socket; sends the request; after receiving the response closes the socket)
P4 =>this is a server and P1's client socket creates sockets dynamically with P4 similar to P3 socket creation
creates a static client socket P2 ==> P1 <== P3(client)creates sockets on the fly
(P1:server and client(creates sockets dynamically with P4)
P3 creates each socket in a thread pool, so in 5 secondsa of time P3 pushes nearly 100 commands or so to the thread pool with few milli seconds delay.
After receiving the response it closes the socket, so socket fds go upto 20 or so and then all are being closed both sides(We found this by placing debug messages, ie all sockets which are accepted are being closed in the server side)
This similar action takes place between P1's client and P4 also. (many sockets are created and closed continuously)
In mean time P2 sends and receives data via the same socket.
What happens is in a long run the P1 process is not reusing some of the socket fds and so the socket fds are increasing and the P1 shoots up to 1024, after which new sockets are not created , which screws up everthing.
Can anyone give suggestions on the way to proceed.
We tried using setsockopt(reuseaddress) but issues not solved...
|All times are GMT +5.5. The time now is 01:45.|