I want to know that how we can chat between 2 ubuntu machines in a network.
there are many messengers but we are prohibited from using those who send the files.
any command line chat messenger for 2 ubuntu in network? or GUI will also work.
I want to know that how we can chat between 2 ubuntu machines in a network.
there are many messengers but we are prohibited from using those who send the files.
any command line chat messenger for 2 ubuntu in network? or GUI will also work.
The simplest way I can think would be using netcat
try this on your own machine in one terminal:
netcat 8080 -l
(this will be the server since we used -l to set it in listen mode)
in the other terminal:
netcat localhost 8080
(this will be the client connecting to the server)
try typing in one of the windows. You can select any port you want for client / server, but privileged ports (below 1024) require root access on the server)
Replace localhost, on the client, with the ip / dns name of the sever you want to connect to if you want to try this over a network
Probably not what you're looking for, but you can just ssh in to limited accounts on each others machines and use wall.
echo
part and use wall
. Then type the message and press Enter.
Apr 12, 2012 at 9:10
@tomodachi suggested using netcat. That is a nice idea, but the disadvantage of a simple nc -l -p 1234
and nc ip.ad.dr.ess 1234
is that text that is being typed gets overwritten by the received messages. Note that by "netcat", I refer to the traditional "swiss army knife" netcat, not the BSD one. netcat-traditional
is not installed by default, so do so. You then might want to change the default netcat program using sudo update-alternatives --config netcat
.
The basics of netcat is that you open a port that can receive a single TCP connection. When data is received, it's printed to standard output. Standard input gets sent to the other side. In a terminal, standard input and standard output are often displayed in one terminal which makes it possible for the data to get mixed up. For example, when you begin to type "hello", if you receive in meantime a message, the terminal could show "helMESSAGElo" even if you are really sending "hello" to the other side.
By splitting opening two terminal tabs and split the view horizontally, you have can show two different shells simultaneously in one window.
tty
in the upper tab, it outputs the filename which represents the current shell. Below, I assume that this output is /dev/pts/2
for host Alice and /dev/pts/4
for the second guy, Bob. Adjust if necessaryUntil now, the steps that had to be executed were the same for both sides of the communication. Now, it gets slightly different.
As "the server" or "the host", start listening on port 1234 (adjust to your own preferences):
cat /dev/pts/2 | nc -l -p 1234 > /dev/pts/2
The other guy "Bob" should connect to your IP (10.2.3.4 below) on port 1234.
cat /dev/pts/4 | nc 10.2.3.4 1234 > /dev/pts/4
Screenshots for the host and receiver side:
Use Bonjour. It is also known as Link-Local XMPP. It's supported by Telepathy/Empathy and others, like Pidgin. The others do need to switch it on in their clients, but there's no need for any servers or anything like that. It works like normal XMPP, so you can send files, use webcam, etc, too.
In Ubuntu, this is called "People nearby". You add it like any other IM account and it works the same way.