289
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
There is one difference to grasp regarding the socket that is sending its outgoing
packets as broadcasts: no incoming UDP packet that would have normally be
interpreted as a re-connect will cause the socket to "switchover" to the source IP-
address of the packet.
Let's evaluate two examples.
Example 1: regular UDP communications
Here is a sample setup for the UDP socket:
sock.protocol= PL_SOCK_PROTOCOL_UDP
sock.inconmode= PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
sock.reconmode= PL_SOCK_RECONMODE_
3
sock.targetip=
"192.168.100.40"
sock.targetport=
1000
sock.localportlist=
"2000"
sock.setdata(
"ABC"
)
sock.send
sock.connect
And here is a hypothetical sequence of events:
Incoming/outgoing datagram
Comment
Datagram with contents "ABC" sent to
192.168.100.40:1000 as soon as
sock.connect method is invoked
We now have the UDP "connection"
with 192.168.100.40:1000
Incoming UDP datagram from
192.168.100.41:20.
This will be taken as a reconnect- the
socket is now engaged in a connection
with 192.168.100.41:20.
Socket sends out another datagram-
this time to 192.168.100.41:20!
Complete switchover happened- the
socket is now transmitting data to the
IP and port of the sender of the
previous incoming datagram
Example 2: regular UDP communications
Here is another setup for the UDP socket:
sock.protocol= PL_SOCK_PROTOCOL_UDP
sock.inconmode= PL_SOCK_INCONMODE_ANY_IP_ANY_PORT
sock.reconmode= PL_SOCK_RECONMODE_
3
sock.targetbcast= YES
sock.targetport=
1000
sock.localportlist=
"2000"
sock.setdata(
"ABC"
)
sock.send
sock.connect
Sequence of events: