Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# SslStream-即使使用端口为143(http)的TcpClient NetworkStream,也必须对客户端进行身份验证_C#_Imap_Sslstream - Fatal编程技术网

C# SslStream-即使使用端口为143(http)的TcpClient NetworkStream,也必须对客户端进行身份验证

C# SslStream-即使使用端口为143(http)的TcpClient NetworkStream,也必须对客户端进行身份验证,c#,imap,sslstream,C#,Imap,Sslstream,我很难连接到: imap.suddenlink.net:143 (IMAP 4) 奇怪的是,在通过向NetworkStream写入命令后,我似乎永远无法接收回数据。 命令似乎写得很好,但在阅读时,除了uint of 10之外,我没有得到任何东西,我认为uint of 10是一个空格或\n 如果我试图用SslStream包装NetworkStream来读取它,看看它是否处理得更好,我会遇到一个必须经过身份验证的异常。 因此,如果我要进行身份验证,结果会出现一个异常:由于意外的数据包格式,握手失败

我很难连接到: imap.suddenlink.net:143 (IMAP 4)

奇怪的是,在通过向NetworkStream写入命令后,我似乎永远无法接收回数据。 命令似乎写得很好,但在阅读时,除了uint of 10之外,我没有得到任何东西,我认为uint of 10是一个空格或\n

如果我试图用SslStream包装NetworkStream来读取它,看看它是否处理得更好,我会遇到一个必须经过身份验证的异常。 因此,如果我要进行身份验证,结果会出现一个异常:由于意外的数据包格式,握手失败

我做错了什么

_tcpClientNetworkStream = new TcpClient(dnsOfHostname, port).GetStream();
byte[] bytes = Encoding.Default.GetBytes(tag + " LOGIN \"user\" \"pass\"\r\n");
_tcpClientNetworkStream.Write(bytes, 0, bytes.Length);
//I then try retrieve the response from the network stream using .ReadByte()    
//First readbyte will return 10 as int, which then cast to a byte and that to a string results in a space

您的实际发送代码是什么?是否使用“\r\n”终止您的命令?@Max使用命令Write I do更新代码。是的,我使用\r\n terminationStill需要帮助,这很奇怪:|嗯,您的代码需要做的第一件事是在连接后立即从IMAP服务器读取问候语响应,然后再发送登录命令。