0
当我点击一个按钮时,我的服务器发送一个请求到客户端,然后,客户端应该将请求传递到一个选择案例来找出该怎么做。编码和选择案例
但是,它不起作用。假设服务器要求“我”,客户端会收到“我”,但会完全避免我选择的情况。
我该如何解决这个问题?
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
我编辑了你的标题。请参阅:“[应该在其标题中包含”标签“](http://meta.stackexchange.com/questions/19190/)”,其中的共识是“不,他们不应该”。 –
执行此msgbox(“[”&request&“]”)或检查字符串的长度。也许有空间或隐藏的字符。 –
显然,我的“我”有8193个空格字符。 这是不好的,我想我会学习RegEx –