本文介绍了写入后保持NetworkStream打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TCP服务器和客户端.客户端使用NetworkStream.Write将图像发送到服务器,然后服务器接收数据并将其显示在图片框中,这在第一次运行时效果很好.但是,每当客户端尝试发送另一个图像时,流就会被锁定.如果我使用NetworkSteam.Close(),则重新打开它并使其正常工作,但我想保持流在整个时间内一直打开并接收多张图像.我该怎么做呢?

预先感谢,
Turtle

I have a TCP server and Client. The client sends an image to the server using NetworkStream.Write, the server then receives the data and displays it into a picturebox, this works fine the first time. But everytime the Client trys to send another image the stream locks up. If i use NetworkSteam.Close() then reopen it and get the stream it works, but i would like to keep the stream open the entire time and receive multiple images. How could i go about doing this?

Thanks in advance,
Turtle

推荐答案


这篇关于写入后保持NetworkStream打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 21:05