Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

HandleDataSub


WeedDealer
 Share

Recommended Posts

Can anyone explain me how the enumeration is linked with the actual sub.I know that it have something to do with this "HandleDataSub(CNewAccount) = GetAddress(AddressOf HandleNewAccount)" but i cant find any calls of the sub.Or if you can point me to a tutorial that will explain me this its ok too.
Link to comment
Share on other sites

That is the call. when the server sends a packet or the client sends a packet, the tcp connection signals that there's a packet being received and then if a packet matches an enumeration. then it will call the sub that was initialized to it. GetAddress(AddressOf ) makes it so if the packet matches, it will call that sub.

Hope that helps!

And for a tutorial, goto the Wiki page.
Link to comment
Share on other sites

I still dont get it. ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)

But im sure that you explained well and im just unskiled and cant figure it out. Thats why im going to use the tutorials you pointed me to.Thanks for help.

Edit:@ Mortal Angels:I want to know the basics on how it works i know what the line do but i want to know how.Thats why im gona read the tuts.Ty for your help too.
Link to comment
Share on other sites

What actually happens is each packet in the enumeration has a number, starting at 0.

HandleDataSub is an array that stores the memory address of each function handling the data, which is why they all must have the same parameters.

The client writes the packet id, the contents of the packet , and then sends it to the server. The server socket first reads the data into an byte array, then the server grabs a long from the byte array which contains the packet id, and calls that function through the memory address stored in the HandleDataSub array.

GetAddress is essentially a way to make use of "pointers" in Visual Basic, I believe the actual dynamic link library for the AddressOf() function was written in C.
Link to comment
Share on other sites

Oh god ty.Your answer is very usefull.

I seen that in the incoming data sub its an handledata call.And if the getaddress is a way of using pointers then when the call is made with the array index(the enumeration variable) its takes it to the sub?

And another question: A byte is 8 bits,a long is 32 so in the alocate sub from clsbuffer the code alocate 4 becasue the long equals 4 bytes?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...