Socket function wrappers.