Netcat works in two mode :- client and server.Take some time to review Netcat's command options.
Listening on a port with Netcat
Listening on a port using Netcat is useful for network debugging client applications. Let's implement a simple chat application using Netcat. First take note of your local IP address (my ip is 192.168.91.129)
1. To listen on port 4444 and accept incoming connections, type on 1st machine
nc -lvp 4444
(This machine behaves as a server since it is listening an incoming connection on port 4444)
2. From a 2nd machine (I am using a windows machine), connect to port 4444 on your machine:
nc -vv 192.168.91.129 4444
(This machine behaves as a client since it is establishing connection with server with an ip address 192.168.91.129 and port 4444)
After connection establishment you can send messages from one machine to another.
After connection establishment you can send messages from one machine to another.
Note:- For using netcat in windows download netcat for windows and run commands from command prompt.In this way our chat application works.
In this way our chat application works.
No comments:
Post a Comment