我正在尝试从端口号读取视频流,但应用程序似乎冻结在serverStream.Read(inStream, 0, (int)clientSocket.ReceiveBufferSize);
。
C#:
private void Form1_Load(object sender, EventArgs e)
{
msg("Client Started");
clientSocket.Connect("127.0.0.1", 65200);
label1.Text = "Client Socket Program - Server Connected ...";
}
private void button1_Click_1(object sender, EventArgs e)
{
NetworkStream serverStream = clientSocket.GetStream();
byte[] outStream = System.Text.Encoding.ASCII.GetBytes(textBox2.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
serverStream.Flush();
byte[] inStream = new byte[10025];
serverStream.Read(inStream, 0, (int)clientSocket.ReceiveBufferSize);
string returndata = System.Text.Encoding.ASCII.GetString(inStream);
msg(returndata);
textBox2.Text = "";
textBox2.Focus();
}