Okay, so it turns out the reason my bot couldn't connect with SC/BW/W2 is that when it converted the binary byte[]s to strings in readNTString(), the bytes got all messed up because of some kind of unicode clash.
My solution was to just keep them as byte arrays, never converting to Strings, but just for the sake of curiosity, does anyone know any way to prevent this?