internal static IntPtr AllocSocketAddress(IPEndPoint endpoint, Loop loop) { IntPtr ret; switch (endpoint.AddressFamily) { case AddressFamily.InterNetwork: ret = loop.Allocs.Alloc(Uvi.sockaddr_in_size); loop.CheckError(Uvi.uv_ip4_addr(endpoint.Address.ToString(), endpoint.Port, ret)); break; case AddressFamily.InterNetworkV6: ret = loop.Allocs.Alloc(Uvi.sockaddr_in6_size); loop.CheckError(Uvi.uv_ip6_addr(endpoint.Address.ToString(), endpoint.Port, ret)); break; default: throw new ArgumentException(String.Format("AddressFamily {0} not supported", endpoint.AddressFamily)); } return(ret); }