Both alternatives are undesirable. Usually you should use read lock. I assume it looks something like this (as you say you are expecting a server):
while (!ssh_channel_poll(...)) { ... }
ssh_channel_read(...);
poll . , SSH , read , , , .
ssh_channel_read(...);