Better handling of socket type