hollywood has send data but accept string
ho if i wand to send binary data (with a lot of 0 inside data) ?
it is possible to send raw data (tcp)
Re: it is possible to send raw data (tcp)
From the documentation:
Code: Select all
In many programming languages a zero character defines the end of the string. Not so in Hollywood. Hollywood allows you to use as many zero characters as you want in your strings. All functions of the string library are zero character safe. For example, this code would return 11:
DebugPrint(StrLen("Hello\0World"))
However, that does not apply to functions that output text. The following example will print "Hello" because of the zero character:
; this will print "Hello" because a zero char terminates the string
DebugPrint("Hello\0World")
Re: it is possible to send raw data (tcp)
interensting ...
however i want to sen binary data all values . so this is possible but complicates stuff..
however i want to sen binary data all values . so this is possible but complicates stuff..
Christos
Re: it is possible to send raw data (tcp)
A common way für sending data over the net avoiding problems with specific chars is to encode (und after receiving decode) as base64. Hollywood also has a function for that in string library
Re: it is possible to send raw data (tcp)
yeah there are alternatives but require computing power/net traffic
in my case a hardware embedded system is on the other side....
thanx for the help anyway it has helped on this
in my case a hardware embedded system is on the other side....
thanx for the help anyway it has helped on this
Christos
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: it is possible to send raw data (tcp)
You don't have to use Base64. Strings can contain any binary data and you can just send this binary data using SendData(). If you want to put binary data into a string, you can use ByteChr() or read the binary data from a file.
Re: it is possible to send raw data (tcp)
ok .. here is an example
value = 3000000
how (easy? ) is to send the data value as 3000000 (value) and not by spliting it to 4 bytes, then inject with bytechr and then send ?
value = 3000000
how (easy? ) is to send the data value as 3000000 (value) and not by spliting it to 4 bytes, then inject with bytechr and then send ?
Christos
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: it is possible to send raw data (tcp)
Ok, I see what you mean. But it should be really easy to write a function which takes a 32-bit number and returns a string of bytes, e.g.
Of course, I could implement a function in Hollywood to easily convert longwords and words to raw bytes if that is of some use...
Code: Select all
Function p_Cvl(v)
Return(ByteChr((v & $ff000000) >> 24) .. ByteChr((v & $ff0000) >> 16) .. ByteChr((v & $ff00) >> 8) .. ByteChr(v & $ff))
EndFunction