2010-11-16 103 views
0

Morning All,VB IRC客户端 - writeStream只在IRC中显示单个字

我一直在用Visual Basic编写一个非常简单的IRC客户端。当我写入网络流时,我有一个非常棘手的问题。在其他客户端,我的消息在第一个空格字符后切断。我确信这是简单的,因为消息正在发送,接收很好,并且在我阅读消息的任何地方调试问题(例如,如果我调试打印正在写入流的消息,它仍然包括所有的单词和空格。)这是我的代码。

在此先感谢

'Send data to IRC Server 
Sub Send(ByVal message) 
    Try 

     'Reformat message to IRC command 
      message = message & vbCrLf 
      Debug.Print(message) 
     'Convert message string into bytes 
     Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(message) 

     'Write data to stream 
     ircStream.Write(sendBytes, 0, sendBytes.Length) 

     'Run test to see if the string sent matches the user input 
     Dim messageSent As String = Encoding.ASCII.GetString(sendBytes) 
     Debug.Print(messageSent) 

     'Display message on the screen(0 = Sent Formatting) 
     PrintToScreen(message, 0) 

    Catch ex As Exception 
     'Catch error and display error message in the debug console 
     Debug.Print("Error Sending") 

    End Try 
End Sub 
+1

您是否尝试过冲洗? – 2010-11-16 11:31:02

+0

没有抱歉,伙伴什么是冲洗大声笑? – Gary 2010-11-16 11:38:56

回答

2

你可能只需要在前面加上 ':' 你的消息是这样的...

PRIVMSG #chan_name :your message with spaces

0

冲洗,调用流......哪冲洗功能(如果我没记错的话)将清除缓冲区中的数据,并在同一时间将其写。

ircStream.Flush() 
+0

谢谢我已经去了,但它不能解决问题 – Gary 2010-11-16 20:28:32

+0

那么,什么是PrintToScreen()? – Pacane 2010-11-16 20:53:28

+0

在富文本编辑器中显示结果的函数,number参数定义文本的外观,即0 =发送,1 =接收。 – Gary 2010-11-16 22:07:08