version 1.96, 2021/03/31 20:41:35 |
version 1.97, 2022/09/11 09:58:06 |
|
|
.Nm |
.Nm |
to listen on a specific port, with output captured into a file: |
to listen on a specific port, with output captured into a file: |
.Pp |
.Pp |
.Dl $ nc -l 1234 \*(Gt filename.out |
.Dl $ nc -l 1234 > filename.out |
.Pp |
.Pp |
Using a second machine, connect to the listening |
Using a second machine, connect to the listening |
.Nm |
.Nm |
process, feeding it the file which is to be transferred: |
process, feeding it the file which is to be transferred: |
.Pp |
.Pp |
.Dl $ nc -N host.example.com 1234 \*(Lt filename.in |
.Dl $ nc -N host.example.com 1234 < filename.in |
.Pp |
.Pp |
After the file has been transferred, the connection will close automatically. |
After the file has been transferred, the connection will close automatically. |
.Sh TALKING TO SERVERS |
.Sh TALKING TO SERVERS |
|
|
of requests required by the server. |
of requests required by the server. |
As another example, an email may be submitted to an SMTP server using: |
As another example, an email may be submitted to an SMTP server using: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
$ nc localhost 25 \*(Lt\*(Lt EOF |
$ nc localhost 25 << EOF |
HELO host.example.com |
HELO host.example.com |
MAIL FROM:\*(Ltuser@host.example.com\*(Gt |
MAIL FROM:<user@host.example.com> |
RCPT TO:\*(Ltuser2@host.example.com\*(Gt |
RCPT TO:<user2@host.example.com> |
DATA |
DATA |
Body of email. |
Body of email. |
\&. |
\&. |