/// <summary> /// 主动连接 /// </summary> /// <param name="ip"></param> /// <param name="port"></param> /// <param name="connectCallback"></param> /// <param name="state"></param> public void Connect(string ip, Int32 port, Action <UVException, object> connectCallback, object state) { ZTImage.Utils.Validate.ThrowIfNullOrWhite(ip, "ip error"); ZTImage.Utils.Validate.ThrowIfZeroOrMinus(port, "port is error"); UVConnectRquest request = new UVConnectRquest(); request.Connect(this, ip, port, (req, status, ex, s) => { if (connectCallback != null) { connectCallback(ex, s); } }, state); }
public static extern int uv_tcp_connect(UVConnectRquest connect, UVTCPHandle socket, ref SockAddr addr, uv_connect_cb cb);
public static void tcp_connect(UVConnectRquest handle, UVTCPHandle socket, ref SockAddr addr, uv_connect_cb cb) { handle.Validate(); ThrowIfErrored(uv_tcp_connect(handle, socket, ref addr, cb)); }