UDP triggers event twice
travis
Junior Member
Is it known?
PROGRAM_NAME='main'
DEFINE_DEVICE
dvUDP = 0:2:1
vdvTest = 36888:1:0
DEFINE_CONSTANT
CHAR UDP_MESSAGE[] = {$49,$51,$00,$00,$00,$14,$00,$07,$01,
$00,$fa,$64,$00,$01,$39,$6e,$00,$01,$0b,$c4}
DEFINE_VARIABLE
VOLATILE CHAR IPUDP[] = '192.168.1.82'
DEFINE_START
IP_CLIENT_OPEN(dvUDP.port, IPUDP, 5600, IP_UDP_2WAY )
DEFINE_EVENT
CHANNEL_EVENT[vdvTest, 1]
{
ON:
{
SEND_STRING dvUDP, UDP_MESSAGE
}
}
DATA_EVENT[dvUDP]
{
STRING:
{
LOCAL_VAR INTEGER numTriggers
LOCAL_VAR CHAR the_data[30]
the_data = DATA.TEXT
numTriggers++
SEND_STRING 0, ITOA(numTriggers)
}
}
I guess you'd need something that speaks UDP to try it out your self. Comments
-
Might just mean the data being returned doesn't all arrive at once so you get 2 or more string events. I know when web scrapping you can trigger multiple sting events for a single get request because the max bytes that can be return in one chunk (MTU) for ethernet connection is 1500. So if you have a web page that returns 40k it going to trigger a lot of string events.
Now I've never done anything with UPD but it should be the same although it doesn't look as if you're expecting more thasn 30 byte in the_data[30] so maybe your device just studders. Are you getting the same strings twice? Maybe you shoulod concatenate your incoming data;the_data = "the_data ,DATA.TEXT" ;
Thread w/ MTU info: http://amxforums.com/showthread.php?t=4406&highlight=web+scrapping
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
