首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >C# antivirus阻止smtp检查

C# antivirus阻止smtp检查
EN

Stack Overflow用户
提问于 2012-05-17 11:39:47
回答 1查看 295关注 0票数 2

我正在尝试用下面的方法检查smtp服务器。

看起来工作正常,但我的杀毒软件有一个拦截警报。

有没有办法检查杀毒软件是否被阻止,然后停止smtp检查?

谢谢。

代码语言:javascript
运行
复制
public static bool Check(string host, string port, string username, string password)
        {
            TcpClient tcpClient = new TcpClient();
            tcpClient.Connect(host, Convert.ToInt32(port));

            NetworkStream netStream = tcpClient.GetStream();
            System.IO.StreamReader strReader = new System.IO.StreamReader(netStream);
            byte[] WriteBuffer = new byte[1024];
            ASCIIEncoding enc = new System.Text.ASCIIEncoding();

            WriteBuffer = enc.GetBytes("USER " + username + "\r\n");
            netStream.Write(WriteBuffer, 0, WriteBuffer.Length);

            WriteBuffer = enc.GetBytes("PASS " + password + "\r\n");
            netStream.Write(WriteBuffer, 0, WriteBuffer.Length);

            if (strReader.ReadLine().Contains("+OK"))
            {
                return true;
            }
            return false;
        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-18 08:05:41

我找不到确切的方法来阻止它。因此,我决定改为捕获socketexception。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10629518

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档