2013年10月8日 星期二

nc - netcat TCP/UDP network testing tool

Client(10.108.2.2) ---- Server(10.108.1.1)

1. Listen as a TCP Server (IPv4)
    Server> nc -4 -l 1234

2. connect to a TCP Server (as TCP Client, IPv4)
    Client> nc -4 10.108.1.1 1234


3. Listen as a UDP Server (IPv4)
    Server> nc -4 -l -u 12345

4. connect to a UDP Server (as UDP Client, IPv4)
    Client> nc -4 -u 10.108.1.1 12345


<[outbound server] 172.16.43.100:1111>
                    +
                    |
                    +-Client(10.108.2.2) ---- Server(10.108.1.1)

5. Recieve and Listen as a TCP Server (IPv4, tcp to tcp)
    Server> nc -4 -l 1234

6. connect to a TCP Server (as TCP Client, IPv4)
    Client> nc -4 72.16.43.100 1111 | nc -4 10.108.1.1 1234


7. Recieve and Listen as a UDP Server (IPv4, tcp to udp)
    Server> nc -4 -l -u 12345

8. connect to a TCP Server (as TCP Client, IPv4)
    Client> nc -4 72.16.43.100 1111 | nc -4 -u 10.108.1.1 12345

udp to tcp
udp to udp
also fine

reference:http://blog.miniasp.com/post/2008/07/A-magic-command-netcat.aspx
                         http://www.thegeekstuff.com/2012/04/nc-command-examples/


沒有留言:

張貼留言

文章分類