Search code examples
vb.netirc

VB IRC Client - writeStream only displays single word in IRC


Morning All,

I have been writing an ever so simple IRC client in visual basic. I have a niggly issue whereby when I am writing to the network stream. On other clients my message cuts off after the first space character. I'm sure this is something simple as the messages are being sent, receiving is fine and debugging the issue it wherever I read the message (i.e. if I debug.print the message being written to the stream it still includes all the words and spaces.) Here is my code.

Thanks in advance

'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

Solution

  • You probably just need to prepend a ':' to your message like so...

    PRIVMSG #chan_name :your message with spaces