More intelligent hack to get enough data from a socket