# decrease TCP connect() system call timeout



## m4rtin (Jun 19, 2014)

In the command below I enable the file /dev/tcp/10.10.10.1/80 both for reading and writing and associate it with file descriptor 3:

```
$ time exec 3<>/dev/tcp/10.10.10.1/80
bash: connect: Operation timed out
bash: /dev/tcp/10.10.10.1/80: Operation timed out

real    1m15.151s
user    0m0.000s
sys     0m0.000s
$
```

This automatically tries to perform a TCP three-way handshake. If 10.10.10.1 is not reachable as in the example above, then the connect system call tries to connect for 75 seconds. Is there a way to decrease this value in FreeBSD 8.0 so it times out, for example after 3 seconds? Or is it even possible to decrease the value of the connect() system call in bash itself?


----------



## SirDice (Jun 19, 2014)

Please note that FreeBSD 8.0 has been End-of-Life since November 2010. Please upgrade to a supported version.

http://www.freebsd.org/security/security.html#sup
Topics about unsupported FreeBSD versions


----------



## m4rtin (Jun 19, 2014)

SirDice said:
			
		

> Please note that FreeBSD 8.0 has been End-of-Life since November 2010. Please upgrade to a supported version.
> 
> http://www.freebsd.org/security/security.html#sup
> Topics about unsupported FreeBSD versions



Ok, but is this supported in the latest FreeBSD versions?


----------



## SirDice (Jun 19, 2014)

The /dev/tcp/host/port 'device' is a specific bash(1) feature. So I would guess the time-out is something bash(1) sets. I have no idea if it's adjustable though. The same feature should work on all versions of FreeBSD.


----------

