Few Q's about Errors :(

10/04/2008 19:25 $HaDoW#1
Hi, I need some help and info why does these errors appear ?
and mabye if you know how can I fix it ?

1#
Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.Character.GetEquipStats(Byte Pos, Boolean UnEquip)
   at COServer_Project.Character.AddExp(UInt64 Amount, Boolean CountMisc)
   at COServer_Project.Character.UseItem(UInt64 ItemUID, String Item)
   at COServer_Project.Client.GetPacket(Byte[] data)
2#
Code:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Hashtable.HashtableEnumerator.MoveNext()
   at COServer_Project.World.RemoveEntity(SingleMob Who)
3#this one heppens after you do /dc command
Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.World.Chat(Character Char, Int16 ChatType, Byte[] Data, String To, String Message)
   at COServer_Project.Client.GetPacket(Byte[] data)
4#
Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.Character.GetEquipStats(Byte Pos, Boolean UnEquip)
   at COServer_Project.Character.SendEquips(Boolean GetStats)
   at COServer_Project.Client.GetPacket(Byte[] data)
5# Main Error
Code:
MySql.Data.MySqlClient.MySqlException: Unable to write to stream ---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.IO.BufferedStream.FlushWrite()
   at System.IO.BufferedStream.Flush()
   at MySql.Data.MySqlClient.PacketWriter.WriteChunk(Byte[] buf, Int32 offset, Int32 length)
   at MySql.Data.MySqlClient.PacketWriter.Write(Byte[] buffer, Int32 offset, Int32 count)
   --- End of inner exception stack trace ---
   at MySql.Data.MySqlClient.PacketWriter.Write(Byte[] buffer, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.NativeDriver.ExecuteCommand(DBCmd cmd, Byte[] bytes, Int32 length)
   at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32 length, Boolean consume)
   at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader)
   at MySql.Data.MySqlClient.MySqlCommand.Consume()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at COServer_Project.DataBase.SaveChar(Character Charr)
error 5 is my enemy ! I want to get rid of it ! its making me so fucking crazy :(
I know meny ppl have this but other says that they fixed it :) how should I fix it too ?

Thx for your help.
10/04/2008 20:28 _Emme_#2
Only looked at the #1 and #4,and on top of my head,this is the things that are mentioned:

UnEquip - Unequip ( obvious )
CountMisc - Of the AddExp shit,you could search for "AddExp" , then right-click it and go to definiton.


and at #4

Unequips,again
And get stats


So,you should look them up into the source,and look into an backup or w/e you got,and see the difference ,and just copy+paste from your backup to your current source.

Copy+Paste ,im sure you know how to do *haha*
10/04/2008 20:57 $HaDoW#3
k thx
btw I updated this error keeps me crazy I know that it heppens only when someone does something in game I think so :P

EDITED: the error 1# is gone but 3 is still coming :(
10/04/2008 23:09 _Emme_#4
Thats in the chat packet,as far as I see .
Added anything new lately which recuires a chat type? If so,try make it an comment then run the server.

You simply put */ at the start then */ at the end of the text you want to comment, or you can just do // infront of each line you want to comment.
10/05/2008 08:39 $HaDoW#5
1# & 4# are fixed
but with the chat I didint ryl understand but it only appear after you use /dc commmand
Code:
if (Splitter[0] == "/dc")
                                    {
                                        MyChar.MyClient.Drop();
                                    }
I think that the command MyChar.MyClient.Drop(); is wrong made...
5# :( is there a fix for that ? this one is making me crazy !
10/05/2008 10:33 _Emme_#6
Never bothered to make an DC command,but maybe this would work,top of my head.
Looked at urs and made some small changes that might do difference.


Quote:
if (Splitter[0] == "/dc")
{
MyChar.Save();
{
MyChar.MyClient.Drop();
}
}
10/05/2008 11:26 $HaDoW#7
k going to test :)
and what about 5# ?
10/05/2008 12:34 _Emme_#8
Mm,its about the MySQL.
Did you use an backup lately? If so,heres your problem;

You added something at your save code,that doesnt exist in your database ( mysql / phpmyadmin ) .

You know at the huge shit of all saves. This is mine,just trying to help you understand what I mean :


Quote:
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp + ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.RealModel + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "', `Equipment` = '" + Charr.Equips + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`Mountain` = " + Charr.Mountain + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`Enemies` = '" + Charr.PackedEnemies + "',`QuestMob` = '" + Charr.QuestMob + "',`QuestKO` = " + Charr.QuestKO + " WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);

Look through yours,and see if you find anything there,which doesnt exist in MySQL.
If thats not the problem,add my MSN,and I will help you over there:)

Goodluck

Emme
10/05/2008 12:41 $HaDoW#9
I think i have you :D
btw you didint told your MSN :D
is it [Only registered and activated users can see links. Click Here To Register...] ?
if it is PM me :D I'm in MSN

btw found dif stuff :)
mine
Quote:
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp + ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.RealModel + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`VP` = " + Charr.VP + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`Enemies` = '" + Charr.PackedEnemies + "',`QuestKO` = '" + Charr.QuestKO + "',`QuestMob` = '" + Charr.QuestMob + "',`QuestFrom` = '" + Charr.QuestFrom + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
and here I marged yours with mine :)
Quote:
MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp + ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.RealModel + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "', `Equipment` = '" + Charr.Equips + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`Enemies` = '" + Charr.PackedEnemies + "',`QuestMob` = '" + Charr.QuestMob + "',`QuestKO` = " + Charr.QuestKO + ",`QuestFrom` = '" + Charr.QuestFrom + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
10/05/2008 13:55 _Emme_#10
No no no.. I didnt mean for you to use my shit. I just posted mine so you would understand a bit better. Also,that is my old if anyone wonders ,using INI files so most of that stuffs I dont use MySQL for anymore.^

And Yes,that is my MSN,guys,please do not add it,im getting sick of noobs adding it daily.
10/05/2008 14:29 $HaDoW#11
lol I marged it only for showing I didint used yours because dif fomr my setings :) Iunderstand that shit :)
I'm not famous here but in 3 weeks I'v learned a lot from this forums :)
and learned coding very easy :D
10/05/2008 14:38 _Emme_#12
You make me happy by saying you actually learned something here.
Also,I saw that you are looking for help,not directly releases/fixes.
Nice to see we still have some persons that actually WANT to learn,and not have a good server,lol.

Keep up to good learning man,and if you have any question I will be here =]
10/05/2008 15:03 $HaDoW#13
hehe :D actually I have a server its in top 19 at extreme top, have players to :D
but I still want to learn and work :)
I have done mutch but still need to learn and fix :)
btw I think I fixed it :D only error 2# comes out but 2 times a day :D

dam still te error 5# shown up :(
emme if you can plz help me with this :(
10/05/2008 18:55 $HaDoW#14
dam I still get error 5# :( its the only error that makes my server unstable !
emme or someone if you can plz help me with this stupid error :(
10/06/2008 00:13 nTL3fTy#15
5. "An existing connection was forcibly closed by the remote host"
Just google the error message and you can easily find a reason for why it's happening:
Quote:
The error comes when you try to do a read/write operation on a socket that has been closed.

[Only registered and activated users can see links. Click Here To Register...]