以下是C#网络类的代码摘录,用于解码TCP套接字消息。 我假设我没有看到第二条跟踪的原因是因为数据对象中有一个或多个不可见的CR或LF。 有没有办法显示这些和/或删除它们,以便我可以达到我的第二个痕迹?
// Get a stream object for reading and writing
stream = client.GetStream();
int i;
// Loop to receive all the data sent by the client.
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
{
data = Encoding.ASCII.GetString(bytes, 0, i);
//1st trace, I see TRIGGER
Debug.Log("0 ASSERT Received: data = " + data );
switch (data)
{
case "TRIGGER":
//Don't see this trace!
Debug.Log(":1 ASSERT TRIGGER RECEIVED");
//etc, etc