If you don't have troubles with other instrumets, problem is in your spec. Analzer. Can you query for example: *IDN? This should be work every time. If this command is supported and it does not work, something is wrong in configuration of your insrtrument.
Some spectrum analyzers especially Rohde&schwarz does not return any data when data are not valid. For example: if you have wrong configuration and measurement is out of range and measurement values are not valid, instrument does not return any value. But in this case you should be received timeout error. In this case you can check message available bit before read function.
I'm not sure, if I help you.
Zdenek