\n is a valid newline character, but it seems you already found that out yourself.

Also, as toufic.dbouk already suggested (and now also discovered by yourself?) using more protocol protocol, i.e. send size information alongside the channel information that you already have.

Cheers,
_