

This option instructs Netcat It must wait x number of seconds before closing the connection.Įl also information should be started as follows: Netcat is configured so that after receiving a EOF( End Of File) terminate the connection, normally this is what happens, but we can modify this default behavior of Netcat adding option -q. 7.-Configure Netcat to stay awake after an EOF: We have seen that server keep running even though also information has been disconnected, thanks to the option -k that we add to the server. We could see in the previous example that if the also information closes the connection also the server So what can we do? Our solution is to use the option -k, which forces the server to keep running. When we have the server running and the also information disconnects, the server also ends: The Hi text will not be sent to the server since reading via STDIN has been disabled. In this example we do it on the client side: This functionality is available through the option -d. 5.-Deactivate the reading by STDIN of Netcat: We can see how the tcp is now accompanied by a 6, indicating the use of IPv6.

Tcp6 0 0 localhost:33234 localhost:2389 ESTABLISHED Tcp6 0 0 localhost:2389 localhost:33234 ESTABLISHED Now, let's force Necati for it to use IPv6: The first parameter of the above output if it were IPv6 it would show a 6 after the tcp, but as we use IPv4 show us only tcp. Tcp 0 0 localhost:50851 localhost:2389 ESTABLISHED Tcp 0 0 localhost:2389 localhost:50851 ESTABLISHED Now, if we run the command netstat, we would see: The options -4 y -6 force Netcat that uses the IPv4 or IPv6 protocol respectively. The connection will be closed after 10 seconds.įinal report: you should not use the option -w with the option -l on the side of server as -w it would have no effect and therefore the connection would remain open indefinitely. Sometimes when we open a connection we do not want it to remain open indefinitely, so to solve this problem we use the option -w, so that after x amount of seconds the connection between client-server is closed. We have transferred data from also information al server. When we check the 'test' file in the server: On the side of also information Suppose we have a file called 'testfile' that contains:Īnd on the side of server we have an empty file called 'test'. We have seen an example of how to use Nectat for client-server communication. Now if we write on the side of the also information, will arrive next to the server: Also, we can use it to conectarnos to a port (2389), recently opened:
