|
-
May 16th, 2008, 01:10 AM
#1
Anything wrong with StrConv() for sending binary data across internet?
I have a class module I made that handles sending, receiving, and processing data automatically for use in Winsock applications.
There is a BuildPacket() function that takes a ParamArray() of arguments to send. It loops through the arguments and appends them to a final string, which will be the "packet" that is sent.
Now, it is coded to handle different data types in the arguments. Ex: You can send numeric data, binary data/byte arrays, etc. all in the same packet. If it encounters a byte array, it uses StrConv() to convert it to a string before appending to the packet.
Now my question is, is this a possible cause for a problem when sending binary data?
Should I rewrite the entire thing to work with byte arrays instead so it is never converted to string first? What happens if I added Unicode support in my program and it was sent across the internet? And/or possibly having 2 users communicating with different "locales"/languages on their computer?
This stuff confuses me. Thanks for any help...or..."very much tx for help, plz inform".
-
May 16th, 2008, 04:47 AM
#2
Re: Anything wrong with StrConv() for sending binary data across internet?
I might be inclined to use byte arrays rather than strings but then I'm biased You don't need to use StrConv to convert a byte array to a string unless you are altering it in some way, I take it you are converting it to unicode? If you create a unicode text file with notepad you might notice that it uses two bytes at the beginning of the file to indicate it's unicodeness(?) and byte order. You could perhaps use a similar system.
-
May 16th, 2008, 04:53 AM
#3
Re: Anything wrong with StrConv() for sending binary data across internet?
Methinks you need dilletante to drop by with respect to the Unicode question. (or read his contributions here: http://www.xtremevbtalk.com/archive/.../t-281422.html and here:http://www.tek-tips.com/viewthread.cfm?qid=1392917)
I've used his suggested method of using the ADODB Stream object for many applications, removes a lot of hassle.
-
May 16th, 2008, 05:05 AM
#4
Re: Anything wrong with StrConv() for sending binary data across internet?
Thats about using UTF-8 encoding which is like a mixture of Ansi and Unicode, it's a good network format because it takes less space than plain old Unicode. Using that ADODB stream thingy is a lot easier that doing the encoding manually in VB.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|