[Help]The loging problem on 5165

01/26/2011 09:59 ryuchetval#1
Hello guys.
I'm using tanel's source 5165 with impulses socket system and I got a problem with the login.
There are some guys that can't log in because of the red line (sometime and for some IPs not all of them, even though it's fixed after the server is restarted)
Code:
                string IP = wr._socket.RemoteEndPoint.ToString().Split(':')[0].ToString();
                if (!Connections.ContainsKey(IP))
                        [B][COLOR="Red"]Connections.Add(IP, 1);[/COLOR][/B]
now the error is
Code:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Generic.Dictionary`2.Resize()
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at NewestCOServer.Main.Sockets.MasterSocket.AcceptConnections(IAsyncResult result) in E:\CO PROJECTS\5165\Fixed Source\rikardo updated\Main\Sockets\MasterSocket.cs:line 48
and I just don't get it why this error appears...any suggestions/help?

also example of ips that are unable to log in(until server is restarted):
Code:
99.98.64.159
41.237.113.249
173.210.141.250
81.154.141.95
and many others....

also if you leave it as it is and turns into this error the login server is turning off...if you make it like
Code:
                string IP = wr._socket.RemoteEndPoint.ToString().Split(':')[0].ToString();
                if (!Connections.ContainsKey(IP))
                    try
                    {
                        Connections.Add(IP, 1);
                    }
                    catch (Exception E)
                    {
                        Program.WriteLine(E.ToString());
                        Program.WriteLine("error ip: " + IP);
                        wr._socket.Disconnect(false);
                        _socket.BeginAccept(AcceptConnections, new Wrapper());
                        return;
                    }
the guy trying to log in and his IP cannot be added into the dictionary gets kicked off the server...but this doesn't fix the problem....suggestions?
01/26/2011 10:04 Korvacs#2
How is the dictionary declared?
01/26/2011 10:20 ryuchetval#3
like this
Code:
private Dictionary<string, byte> Connections;