proper ip checking in socket connections