我实际上在一个Web应用程序(ASP.NET MVC)上工作,它在TCP/IP的本地网络上向胖客户端应用程序(我无法修改)发送命令.我需要胖客户端应用程序响应我的命令或给我信息,所以连接需要一直打开.我创建一个循环来检查服务器响应,如下所示:
public static async void getMessage()
{
while(true)
{
// Buffer to store the response bytes.
Byte[] data = new Byte[100000];
// String to store the response ASCII representation.
String responseData = String.Empty;
// Read the first batch of the TcpServer response bytes.
Int32 bytes = await stream.ReadAsync(data, 0, data.Length);
if (bytes == 0) continue;
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
Debug.Write(responseData);
await stream.ReadAsync(data, 0, data.Length);
}
}
Run Code Online (Sandbox Code Playgroud)
这实际上是有效的,我收到了来自服务器的响应,但是浏览器一直在"等待localhost",那么有没有更好的方法来做到这一点,没有浏览器上的循环?
非常感谢 !
软件包版本6.0.0-beta902
例子 :
public class TestModel
{
/// <summary>
/// This is description of Name
/// </summary>
public string Name { get; set; }
}
public IActionResult HelloWorld(TestModel model)
{
return Content("hello " + model.Name);
}
Run Code Online (Sandbox Code Playgroud)
为什么 Swagger UI 不显示 Name 参数说明?
asp.net ×2
.net ×1
azure ×1
azure-machine-learning-studio ×1
regression ×1
swagger ×1
swashbuckle ×1
tcp-ip ×1