M
M
Maxim Tyulpakov2020-12-09 11:09:26
linux
Maxim Tyulpakov, 2020-12-09 11:09:26

Linux programming. How to create a chat from one terminal to another using C files?

Maybe someone came across an implementation of a program to run on two terminals for exchanging messages between them through a file - one transmits (writes a file), the second receives ...
And in pure C using system calls (for example, open (), read () ... )

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2020-12-09
@leahch

The inetutils GNU package has a talk utility - https://www.gnu.org/software/inetutils/
Well, you can stir up message queues if you write it yourself - https://www.opennet.ru/docs/RUS/lpg/ node6.html#SEC...
Here is an example - https://gist.github.com/Mark-htmlgogogo/e024c36541...
PS. Well, passing messages through files is a very bad idea. Pipes are also not a good solution.
The best thing is to use sockets!

S
Saboteur, 2020-12-09
@saboteur_kiev

In posix filesystems, there is such an entity as pipe
mkpipe ./chat1
mkpipe ./chat2
one program writes to chat1 and reads from chat2, the other vice versa

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question