Maybe you want to return here if data was read?  Otherwise it looks like it's just trying to read from the socket retries times regardless of the result.

I'd also consider adding a time.Sleep on failure so that the loop is actually dependent on some kind of criteria, and not the raw speed at which the loop executes.

Same applies to the write method.