开发者

C# IRC client not sending data (it seems)

A friend and I are working on an IRC client in C#, just for practice.

We've implemented it so that it listens for data all the time on a separate thread, even though I开发者_运维问答 don't believe that this should interfere in any way.

We have a IRCClient class that uses the following Send method, which, apparently doesn't work.

public void Send(string command)
{
    NetworkStream stream = this.client.GetStream();
    StreamWriter writer = new StreamWriter(stream);

    writer.Write(command + "\r\n");
    writer.Flush();
}

The "client" attribute is a TcpClient that is properly connected to the IRC server. And yes, we can receive data.


You can use Wireshark ( http://www.wireshark.org/ ) in order to check the raw data you send and receive. It has support for IRC protocol and it will help you a lot with debugging your client.


I figured out that the IRC client (in order to send commands) must exclude the preceding slash "/". So instead of "/say hello", you just have to send "SAY hello".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜