Here we have a very simple example of how to make sure the wireless AP does not drop the connection when in extended idle state. What the code is doing is to periodically
dim ka_counter as byte=0 'counter for keep alive
'This is the code for setting up the socket
sub on_sys_init()
sock.num=4
sock.rxbuffrq(1)
sock.txbuffrq(1)
sock.protocol=PL_SOCK_PROTOCOL_UDP
sock.localportlist="10000"
sock.allowedinterfaces="WLN"
sock.targetbcast =YES
sock.inconmode=PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
sock.reconmode=PL_SOCK_RECONMODE_0
end sub
'this is the code that you use for sending out the broadcast packet,
sub on_sys_timer
if ka_counter=120 then
sock.num=4
sock.targetinterface = PL_SOCK_INTERFACE_WLN
sock.targetip = "255.255.255.255"
sock.targetport=10000
sock.setdata("1")
sock.send
sock.connect
ka_counter=0
else
ka_counter=ka_counter+1
end if
end sub
Comments
0 comments
Please sign in to leave a comment.