void Connect() { Console.WriteLine("[Connecting to {0}...]", serverHost); BufStruct bufStruct = default(BufStruct); serverHost.Connect(socket, DnsPriority.IPv4ThenIPv6, ProxyConnectOptions.None, ref bufStruct); if (bufStruct.contentLength > 0) { throw new NotImplementedException(); } Console.WriteLine("[Connected]"); if (bufStruct.contentLength > 0) { if (messageLogger != null) { messageLogger.Log("[RecvThread] Received {0} bytes", bufStruct.contentLength); } if (connectionLogger != null) { connectionLogger.LogDataBToA(bufStruct.buf, 0, (int)bufStruct.contentLength); } } }
public static Socket NewSocketConnection(ref InternetHost host) { Socket socket = new Socket(host.GetAddressFamilyForTcp(), SocketType.Stream, ProtocolType.Tcp); BufStruct dataLeftOverFromProxyConnect = default(BufStruct); host.Connect(socket, DnsPriority.IPv4ThenIPv6, ProxyConnectOptions.None, ref dataLeftOverFromProxyConnect); if (dataLeftOverFromProxyConnect.contentLength > 0) { throw new NotImplementedException(); } return(socket); }