Prolog TCP socket communication (reading before writing)

Searching this site for chat leads to a chat server implemented with Prolog : https://rosettacode.org/wiki/Chat_server#Prolog

HTH


Also to quote text as Prolog source code use ` and not '. See: Language highlighting