当我点击一个按钮时,我的服务器向客户端发送一个请求,然后,客户端应该将请求传递给一个选择案例以弄清楚要做什么。
但是,它不起作用。假设服务器要请求“i”,客户端会收到“i”,但会完全避免我的选择情况。
我怎样才能解决这个问题?
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
If _TCPStream.DataAvailable Then
Dim rcvdbytes(_TCPClient.ReceiveBufferSize) As Byte
_TCPStream.Read(rcvdbytes, 0, CInt(_TCPClient.ReceiveBufferSize))
Dim request As String = System.Text.Encoding.ASCII.GetString(rcvdbytes)
Execute_Action(request)
End If
End Sub
Private Sub Execute_Action(ByVal request As String)
msgbox(request) 'Says the request is "i" but do nothing
Select Case request
Case "i"
messagebox.show("Hello")
End Select
End Sub