Hacker News new | past | comments | ask | show | jobs | submit login

It's definitely not right as far as the C interface is concerned - and Google indicates that the Python interface doesn't do anything extra. That said, it probably does generally work considering the small size of the messages, especially if the dispatcher is run locally. It's unlikely that a two-byte or ten-byte message would get fragmented, though it technically could - and that's all that is sent by the dispatcher.

That said, this should be a loop that combines all the responses until you receive a response of length zero, indicating EOF. The actual code to correctly handle this is really simple if you don't do any extra error handling - but it's not obvious if you haven't done some socket programming before.

This code will probably work until the dispatcher and clients are expanded upon, resulting in more complex messages that eventually lead to sporadic fragmentation.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: