Some problems with socket getting corrupted after connection end outside, trying to figure out what makes it do so