Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Couple questions about a procedure in a class definition
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01250023
Message ID:
01250032
Vues:
13
What exactly the GetData method is doing? Can we just pass an empty string always?

>Jay,
>
>Mike already explained, I just wanted to repeat something I told long ago <g> It would be better for your class if you change SPACE(256) to SPACE(bytesTotal), for bytesTotals is the number of bytes (Characters) that are needed to fill the "buffer" (strData), again, if you receive 6 characters, you are wasting 250 and, furthermore, how do you know which one were received and wich ones are the "filler" spaces? You can not trim, for you might've received trailing spaces, or only spaces! But if you received more than 256 characters, what will happen with the rest? You gave GetData only space to use 256, the others might get discarded.
>
>
>>Couple questions as to what this procedure is doing. It works, but I'm not sure about the "@strData" in the GETDATA. Is that a variable by reference? So that after GETDATE runs, the value of strData is returned? Also, why the "SPACE(256)" line? Is it to define it as a string, or to define the length, or both? It works with strings much larger than 256, so I'm just curious what the purpose is. Thanks!
>>
>>
>>	PROCEDURE DMSWinsockControlEvents_DataArrival(bytesTotal AS NUMBER) AS VOID ;
>>		HELPSTRING "Occurs when data has been received from the remote computer"
>>
>>		strData = SPACE(256)  && Define string to pass to GetData
>>
>>		THIS.oSock.GETDATA(@strData)
>>
>>		? strData
>>
>>	ENDPROC
>>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform