Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: BaDDBLooD on June 26, 2004, 02:03 PM

Title: VB.Net Connecting to BNLS Problems
Post by: BaDDBLooD on June 26, 2004, 02:03 PM
Http://www.clan-aod.net/badd/Test.zip

If you go to File > Connect

You should see the problem.. have NO Clue why this happens
Title: Re:VB.Net Connecting to BNLS Problems
Post by: MyndFyre on June 27, 2004, 02:53 AM
After an arduous debugging session (you really should try it some time), I found the cause of your problem.

frmMain.vb:


   Private Sub sckBNLS_onConnect() Handles sckBNLS.onConnect

       AddChat(rtbChat, Color.Green, "BNLS: Connection Established!")

       Dim packet As New BaDDChaT.BNLSPacket(&HE)
       packet.InsertBYTE(&H0)
       sckBNLS.SendData(packet.Data)

   End Sub


Step down into Sub New of BNLSPacket(ByVal Byte)

PacketBuffer.vb:


       Public Sub New(ByVal PacketID As Byte)
           MyBase.New(PacketID, Medium.BNLS)
       End Sub


Looks right.  Go to the base:


       Protected Sub New(ByVal PacketID As Byte, ByVal ServerType As Medium)
           m_packetId = PacketID
           m_medium = ServerType
       End Sub


You forgot to call the parameterless constructor!  This can be corrected by updating your sub (here) to:


       Protected Sub New(ByVal PacketID As Byte, ByVal ServerType As Medium)
 ' LOOK HERE!
           Me.alBuffer = new ArrayList()
           m_packetId = PacketID
           m_medium = ServerType
       End Sub


With as much as I've helped you up to this point, you ought to put my name right around the top of your "thank you" list.  :-P

[edit] And update your buffer so that it's not using ArrayList!  Make a ByteArrayList or something!  That way you don't need to deal with boxing and unboxing the value types of Byte within the ArrayList (because internally it's stored as Object, which is a reference type....  You'll get about 5-8 wasted clock cycles every time you convert between Object and Byte). [/edit]
Title: Re:VB.Net Connecting to BNLS Problems
Post by: BaDDBLooD on June 27, 2004, 10:47 AM
Don't Worry!

Your gonna be Commented Lots =)