Why is tcp_tw_reuse turned off by default?
Saw a great article on this today, that provides a really in depth answer that I thought anyone that ran across this question should have:
http://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html
After reviewing it, it looks like the change I made to use tcp_tw_reuse doesn't even impact incoming connections, so it appears that my original solution was a fruitless change on my part.
error setting net.ipv4.tcp_tw_reuse & net.ipv4.tcp_tw_recycle in sysctl.conf
So that syntax is for the linux kernel, and you would use 1 or 0 for true/false, not the actual spelled out words. So in your example, it would be:
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
If you're trying to adjust this setting in OSX on your Mac, then it's a different syntax. It would be:
net.inet.tcp.msl=1000
Hope that helps.
Why would connect() give EADDRNOTAVAIL?
Check this link
http://www.toptip.ca/2010/02/linux-eaddrnotavail-address-not.html
EDIT: Yes I meant to add more but had to cut it there because of an emergency
Did you close the socket before attempting to reconnect? Closing will tell the system that the socketpair (ip/port) is now free.
Here are additional items too look at:
- If the local port is already connected to the given remote IP and port (i.e., there's already an identical socketpair), you'll receive this error (see bug link below).
- Binding a socket address which isn't the local one will produce this error. if the IP addresses of a machine are 127.0.0.1 and 1.2.3.4, and you're trying to bind to 1.2.3.5 you are going to get this error.
- EADDRNOTAVAIL: The specified address is unavailable on the remote machine or the address field of the name structure is all zeroes.
Link with a bug similar to yours (answer is close to the bottom)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4294599
It seems that your socket is basically stuck in one of the TCP internal states and that adding a delay for reconnection might solve your problem as they seem to have done in that bug report.
Related Topics
Google-Chrome Failed to Move to New Namespace
How to Create a File in Linux from Terminal Window
Recursive Copy of a Specific File Type Maintaining the File Structure in Unix/Linux
Git Enter Long Passphrase for Every Push
Nginx Not Listening to Port 80
How Are Sbrk/Brk Implemented in Linux
How to Compile Simple C Program in Linux Mint 15
Can Ebpf Modify the Return Value or Parameters of a Syscall
Whiptail: How to Redirect Output to Environment Variable
Swift on Os X Compiling for Linux
How to Make a Public HTML Folder in Ubuntu
How to Convert Spaces to Tabs in Vim or Linux
How to Delete Many 0 Byte Files in Linux
Exclude List of Files from Find
Update-Alternatives: Warning: /Etc/Alternatives/Java Is Dangling
Device Tree Compiler Not Recognizes C Syntax for Include Files