settings.setData(settings#NET_IPv4_MASK,string(255,255,255,0),4)
This is an example line from one of the example .spin files. The prop tool complains that strings must be from 1-255. How do I actually use a subnet mask of 255.255.255.0 if I can't put 0's in strings.
using 0's in settings.setData
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 25
- Joined: Wed Oct 08, 2008 1:13 pm
Re: using 0's in settings.setData
I answered my own question:
Code: Select all
DAT
MAC BYTE $de, $ad, $be, $ef, $ca, $fe
IP BYTE 10,0,1,2
MASK BYTE 255, 255, 255, 0
GATEWAY BYTE 10,0,1,1
DNS BYTE 10,0,1,5
...
settings.setData(settings#NET_IPv4_ADDR,@IP,4)
settings.setData(settings#NET_IPv4_MASK,@MASK,4)
settings.setData(settings#NET_IPv4_GATE,@GATEWAY,4)
settings.setData(settings#NET_IPv4_DNS,@DNS,4)
- darco
- Posts: 118
- Joined: Wed Jun 04, 2008 7:54 pm
Re: using 0's in settings.setData
Yeah, using the "string(...)" constant was a bit of a convenient hack for representing IP addresses in-line...at least as long as you don't have a zero in your IP address! Unfortunately, Parallax had the foresight of a myopic orangutan when they developed "spin", and decided that no one in the right mind would ever want to put a zero in an inline string constant.
Spin is the worst thing about the Propeller. The hardware is beautiful. The language is BANNED.
Spin is the worst thing about the Propeller. The hardware is beautiful. The language is BANNED.
Please be positive and constructive with your questions and comments.