Sending and receiving text using C network sockets and Linux terminal

62 Views Asked by At

I am trying to build a C application which will allow 2 users to connect and exchange text messages. The application will provide users with a simple TUI built using the ncurses library, and for networking, I am using libevent.

What I don't understand is can I just read characters on one side and print them on the other using library functions? Could this allow a malicious user to send special characters like the ones ncurses uses to manipulate the terminal, and that way send instructions to the receiving user's terminal? Also, do I need to worry about character encoding when reading the characters using ncurses library functions from stdin and sending them over the network?

I searched the web and failed to find the appropriate solution. If you could provide me with an explanation or point me to some other literature where I could find the answer, I would be very grateful.

0

There are 0 best solutions below