2010-11-16 46 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