小编Sco*_*son的帖子

编程错误我似乎无法修复:无法将数据写入传输连接

我想为长篇大论道歉,但我想确保提供所需的一切以获得一些帮助.

错误:无法将数据写入传输连接:已建立的连接已被主机中的软件中止.

错误出现在第307行:

await writer.WriteLineAsync("FromServer: Scan Completed");
Run Code Online (Sandbox Code Playgroud)

我试过的:

  1. 禁用AV
  2. 已禁用FW(虽然我认为在这种情况下不需要它)
  3. 谷歌搜索 - 发现成千上万的结果,但没有一个结果似乎解释了如何解决这个问题.

重现问题:

  1. 启动服务器
  2. 启动客户端

服务器:

using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;


namespace NCServer
{
    class Program
    {
        /// <summary>
        ///  General GLOBAL strings
        /// </summary>
        public static readonly string AppRoot = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
        public static string curDir = System.Environment.CurrentDirectory;
        public static int i …
Run Code Online (Sandbox Code Playgroud)

c# client-server visual-studio-2013

5
推荐指数
1
解决办法
2432
查看次数

标签 统计

c# ×1

client-server ×1

visual-studio-2013 ×1