I'm trying to connect to an Irc server which gave me error:
Authentication failed because the remote party has closed the transport stream.
The C# code:
_client = new StandardIrcClient();
_ircUrl = "irc.blabla.com";
_nick = "MyNick";
_port = 7021;
_useSsl = true;
_channels = new[] { "#test" };
IrcUserRegistrationInfo info = new IrcUserRegistrationInfo
{
NickName = _nick,
Password = "",
RealName = _nick,
UserName = _nick
};
_client.RawMessageReceived += (s, ev) =>
{
write(ev.RawContent);
_execute(ev.RawContent);
};
_client.Connected += (s, ev) =>
{
write("Connected");
};
_client.Registered += (s, ev) =>
{
_log.Debug("registered");
if (!string.IsNullOrWhiteSpace(_inviteCommand))
{
if (_inviteCommand.IndexOf(":invite", StringComparison.OrdinalIgnoreCase) > -1)
{
_client.SendRawMessage($"PRIVMSG {_inviteCommand.Replace("invite", ":invite")}");
}
}
_client.Channels.Join(_channels);
};
_client.ConnectFailed += (s, ev) =>
{
write(ev.Error.Message);
_client.Disconnect();
};
_client.Disconnected += (s, ev) =>
{
_log.Debug("disconnected");
write("Disconnected");
};
_client.Error += (s, ev) =>
{
_log.Error(ev.Error);
};
_client.ErrorMessageReceived += (s, ev) =>
{
_log.Error(ev.Message);
};
bool useSsl = _port > 0 && _useSsl;
if (useSsl)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}
_client.Connect(_ircUrl, _port == 0 ? 6667 : _port, useSsl, info);
EDIT
I'm using Net Standard library so I cannot add SSL3 since it says is not supported protocol.
Connect
method – Snake Eyes