Mirage Source http://www.miragesource.net/forums/ |
|
aLen use? http://www.miragesource.net/forums/viewtopic.php?f=201&t=1163 |
Page 1 of 40 |
Author: | Shannara [ Sun Jan 14, 2007 7:42 pm ] |
Post subject: | aLen use? |
Been looking through some sources, alen is being a pos, even though instructions followed .. bah ... Code: Public Function aLen(ByRef dBytes() As Byte) As Long On Error Resume Next aLen = (UBound(dBytes) - LBound(dBytes)) + 1 If Err.Number <> 0 Then aLen = 0 Err.Clear End If End Function Use would be ... Code: Dim Buffer() as byte
Erase Buffer Buffer = "" Buffer = AddByteToBuffer(Buffer, 1) The above always result in a runtime error ... now according to the instructions : Quote: 'One thing to note, always initialize your byte array to "".
'i.e. dBytes = "" 'This sets the UBound of the byte array to -1, allowing us 'to have a size of 0. If the array is not initialized, or 'you have emptied the array, aLen will cause a RT error. Doesn't seem to be accurate. As shown by the code above, I shouldn't receive a runtime error. |
Author: | Obsidian [ Sun Jan 14, 2007 7:57 pm ] |
Post subject: | |
yeah i had that same problem. It's weird, but when i quit using "Erase Buffer", the error went away... |
Author: | Shannara [ Sun Jan 14, 2007 8:00 pm ] |
Post subject: | |
Perfect, thanks |
Author: | Obsidian [ Sun Jan 14, 2007 8:11 pm ] |
Post subject: | |
Are you rewriting ver's tutorial and/or releasing a code with working byte arrays? |
Author: | Shannara [ Sun Jan 14, 2007 8:28 pm ] |
Post subject: | |
Im shifting through the Kingdom of Cryshall code as well as the VBGore code To answer your question, I'm using Socket Tools for my project, and figured i'd try out the byte based networking route for this bugger. I'm create a few classed for use with Socket Tools and the networking. Once I am finished with the conversion, I'm looking at releasing the classes and tutorial on how to use the classes on this forum. |
Author: | Spodi [ Sun Jan 14, 2007 10:15 pm ] |
Post subject: | |
I just store a separate variable that keeps track of the array UBound(), this way you don't have to call for the UBound() along with don't have to worry about the array not existing (UBound returning an error). When you erase the array, you just set your UBound variable to -1. I would presume erasing is faster then redimming 0 since theres no memory it has to try and preserve, along with you free up that last index. |
Author: | grimsk8ter11 [ Mon Jan 15, 2007 2:26 am ] |
Post subject: | |
Shan you cant set buffer =" " has to be buffer = "" |
Author: | Lea [ Mon Jan 15, 2007 4:31 am ] |
Post subject: | |
You don't need to do Buffer="" for some things. If I remember correctly, if the packet has a string in it you need to do it. Haven't messed with it for a while, and instead of testing each packet it's easier to just include that lien. |
Author: | grimsk8ter11 [ Mon Jan 15, 2007 3:58 pm ] |
Post subject: | |
Dave wrote: You don't need to do Buffer="" for some things. If I remember correctly, if the packet has a string in it you need to do it. Haven't messed with it for a while, and instead of testing each packet it's easier to just include that lien.
iw as jsut saying, since shan posted it as Buffer=" ", i believe its only used once. |
Author: | Matt [ Mon Jan 15, 2007 4:14 pm ] |
Post subject: | |
I was talking to Shan about that last night, he said he fixed that issue long ago. Lol. |
Author: | wanai [ Mon Jan 31, 2022 1:24 pm ] |
Post subject: | Re: aLen use? |
Crea |
Author: | wanai [ Mon Jan 31, 2022 1:25 pm ] |
Post subject: | Re: aLen use? |
202.92 |
Author: | wanai [ Mon Jan 31, 2022 1:26 pm ] |
Post subject: | Re: aLen use? |
PERF |
Author: | wanai [ Mon Jan 31, 2022 1:27 pm ] |
Post subject: | Re: aLen use? |
PERF |
Author: | wanai [ Mon Jan 31, 2022 1:28 pm ] |
Post subject: | Re: aLen use? |
Juli |
Author: | wanai [ Mon Jan 31, 2022 1:29 pm ] |
Post subject: | Re: aLen use? |
Heat |
Author: | wanai [ Mon Jan 31, 2022 1:31 pm ] |
Post subject: | Re: aLen use? |
Miss |
Author: | wanai [ Mon Jan 31, 2022 1:32 pm ] |
Post subject: | Re: aLen use? |
Yash |
Author: | wanai [ Mon Jan 31, 2022 1:33 pm ] |
Post subject: | Re: aLen use? |
Esma |
Author: | wanai [ Mon Jan 31, 2022 1:34 pm ] |
Post subject: | Re: aLen use? |
OZON |
Author: | wanai [ Mon Jan 31, 2022 1:35 pm ] |
Post subject: | Re: aLen use? |
John |
Author: | wanai [ Mon Jan 31, 2022 1:36 pm ] |
Post subject: | Re: aLen use? |
Atta |
Author: | wanai [ Mon Jan 31, 2022 1:37 pm ] |
Post subject: | Re: aLen use? |
Deko |
Author: | wanai [ Mon Jan 31, 2022 1:38 pm ] |
Post subject: | Re: aLen use? |
Fisk |
Page 1 of 40 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |