In Solaris10, accept() is not accepting any new connections and
throwing EINVAL (Invalid argument) error.

I've properly created the socket before calling accept(). Man page of
accept states that EINVAL (Invalid argument) would be thrown if socket
is not created properly.

While I checked, many connections are waiting in TIME_WAIT state.

Currently my system's tcp level parameters.
tcp_time_wait_interval - 60000

I'm not sure whether many connections in TIME_WAIT state will prevent
accepting any new connections and leading to accept() failures?

Do I've to tweak any tcp level parameters to avoid these accept()

Strangely the same code works fine if the number of connections are
medium. These errors shoot up, only if the number of connections are
very high.

I tried to poke this by going throw accept() code. I could find only
part of the source code of accept() and not fully.

It would be great, if somebody suggest some solution to this problem
or point me to the accept() code.