Note that, since you didn't mentionned which OS you're working with, i'll assume that it's GNU/Linux (which maybe a bad assumption since this is "UNIX & Linux").
Tweaking kernel behaviour
Under Linux, tweaking your TCP stack at runtime is usually achieved using sysctl
and/or procfs.
So you probably should start by having a look to:
- tcp(7) manpage
- Files under
Documentation/sysctl/
on your kernel source code. (You can also use this site).
To see if there's some options/parameter that would allow that.
One step further
After a quick look at kernel source code ( net/ipv4/tcp.c
) it looks that the use of FIN flag to shutdown is "hardcoded" and can't be changed... sorry.
Maybe you can try to write a patch to change this behaviour... but i wouldn't push in production server such a patch ;-)
To conclude
It looks that there's no way to do what you asked for.
Nevertheless, maybe you can mitigate the "too many TIME_WAIT" issue by tweaking some other parameters such as net.ipv4.tcp_fin_timeout (also reachable at /proc/sys/net/ipv4/tcp_fin_timeout
).
Note that, if you have the hand on your application source code, you can also tweak its behaviour using setsockopt()
on the created socket.