> i read somewhere that sockets are full duplex, so initially i tried to build an architecture like this:
a socket is *one* end of a two-way communications link.
a BSD socket maintains a separate send buffer and a receive buffer, and is full-duplex (you can both send and receive data on it).
to send or receive data, you need two sockets (one at either end).
in your first example, you are trying to use the *same* socket at both ends.
create *two* sockets, one for the client and another for the server.
(eg. socketpair does this for UNIX sockets.
http://www.freebsd.org/cgi/man.cgi?query=socketpair)
after forking, close the client socket in the server, and the server socket in the client.
and things should be ok.
+---------------+ +---------------+
| | | |
| peer1 | | peer2 |
| |port1 port2| |
| sock1----|---------------|----sock2 |
| | | |
| | | |
+---------------+ +---------------+
> Could this diversion be "easily" done, by using ncurses
yes.