C# irc 客户端 streamwriter 只发送一个字

C# irc client streamwriter just send one word

我有来自某个站点的源 irc 客户端。这是一些代码:

     using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Text;
        using System.Net;
        using System.Net.Sockets;
        using System.IO; 
        using System.Text.RegularExpressions; 
    namespace tes_irc
    {
        class Program
        {
            static string[] usuarios; 
            static void Main(string[] args)
            {

                NetworkStream conexion;
                TcpClient irc;
                StreamReader leer_datos;
                StreamWriter mandar_datos;

                string host = "irc.dal.net";
                string nickname = "testing";
                string canal = "#gsgsge";


        string code = "";
            leer_datos = new StreamReader(conexion);
            mandar_datos = new StreamWriter(conexion);

            mandar_datos.WriteLine("NICK " + nickname);
            mandar_datos.Flush();
            mandar_datos.WriteLine("USER " + nickname + " 1 1 1 1");
            mandar_datos.Flush();
            mandar_datos.WriteLine("JOIN " + canal);
            mandar_datos.Flush();
            while (true) // Mi bucle eterno
            {
                while ((code = leer_datos.ReadLine()) != null)
                {
                    Console.WriteLine("Code : " + code);
                    Match regex = Regex.Match(code, "PING(.*)", RegexOptions.IgnoreCase);

                    if (regex.Success)
                    {
                        Console.WriteLine("hehe");
                        string te_doy_pong = "PONG " + regex.Groups[1].Value;
                        mandar_datos.WriteLine(te_doy_pong);
                        mandar_datos.Flush();
                    }

                    regex = Regex.Match(code, ":(.*) 353 (.*) = (.*) :(.*)", RegexOptions.IgnoreCase);
                    if (regex.Success)
                    {
                        string usuarios_lista = regex.Groups[4].Value;
                        usuarios = usuarios_lista.Split(' ');
                        foreach (string usuario in usuarios)
                        {
                            Console.Write("[+] User : " + usuario);
                        }

                        mandar_datos.WriteLine("PRIVMSG" + " " + canal + " " + "Hello World");
                        mandar_datos.Flush();
                    }
                }
            }
        }
    }
}

连接成功,但是当我写发送消息时 "Hello world" 只是发送 "Hello"。这段代码有什么问题?也许之前必须编码字符串?或者?请帮助我。先谢谢了:)

IRC 命令的最后一个参数应以冒号字符为前缀 (:)。否则参数的解析将在第一个空格处结束。

mandar_datos.WriteLine("PRIVMSG" + " " + canal + " " + ":Hello World");