Question: There is a daemon process listening on port 5144, which I cannot to modify.

I want to use netcat to send the contents of a text file to the server, but this causes `netcat` to hang the terminal until I press `Ctrl`+`C`:

```
cat file.txt | nc -u 127.0.0.1 5144

```

The only way I am able to get it to work is by running `nc -u 127.0.0.1 5144` and copy/pasting the contents of the file manually.

Any ideas?

---

Also note:

1. `cat file.txt | ...` leads to `bash: ...: command not found` and I can continue to use the terminal
2. using `nc -u 127.0.0.1 5144 < file.txt` leads to the same behavior as using | above

Answer: 
Assuming that after sending EOF connection will stay idle, you can use `-w timeout` option, which works for `timeout` being equal to zero (unlike stupid `-q` option...)

```
cat file.text | nc -u localhost 4300 -w0

```
If you are transferring from FreeBSD to Windows:

FreeBSD: `cat file.txt | nc -N 10.0.0.5 5144`

`-N` will shutdown the network socket after EOF

Windows: `nc -l -p 5144 > output.txt`

`-l` will stop listening on connection closed (unlike `-L`)