UDP triggers event twice
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. 0
Comments
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; Thread w/ MTU info: http://amxforums.com/showthread.php?t=4406&highlight=web+scrapping