in reply to How to make EOF?

Are you looking for an EOF (if so, just close the socket) or are you looking for a way within the YAML document to say "I'm done"? If so, from the YAML 1.0 spec (applies to 1.1 and 1.2 as well):
YAML uses three dashes (“---”) to separate documents within a stream. Comment lines begin with the pound sign (“#”). Three dots (“...”) indicate the end of a document without starting a new one, for use in communication channels.

Best, beth