Datagram socket correct syntax
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Datagram socket correct syntax
I am sending out a request to all possible computers on the network. Currently, I am using a loop that sends the message to each IP address, one at a time. I understand I should be able to use "open datagram socket to ????", but do not know how to write that out.
The computers at the other end receive the message and then send back a message to the originating computer. Is a datagram socket the best way to go for this? Can someone show me how to write out the code; i.e. "open datagram socket to socket ("192.168.0.1 - 255") with message. Don't know if I still have to send it out one IP address at a time or if the proper IP syntax is "192.0.0.0" or ??
Thanks,
E
The computers at the other end receive the message and then send back a message to the originating computer. Is a datagram socket the best way to go for this? Can someone show me how to write out the code; i.e. "open datagram socket to socket ("192.168.0.1 - 255") with message. Don't know if I still have to send it out one IP address at a time or if the proper IP syntax is "192.0.0.0" or ??
Thanks,
E
Re: Datagram socket correct syntax
In general, sending a packet to address 255 (as in 192.168.0.255) is broadcast to all addresses in the subnet.
This might help:
http://lessons.runrev.com/spaces/lesson ... ng-sockets
This might help:
http://lessons.runrev.com/spaces/lesson ... ng-sockets
Re: Datagram socket correct syntax
Thank you mwieder, I did get some extra ideas from the tutorial. Just to be clear on your answer, here is what I am using now:
probIP sends out the message "probing" to each socket. Instead, would I do this:
and expect every computer in the 192.168.0.*** range that is listening on socket "1234" to receive a message?
I did not have any luck with the above code and need more details about how to send "probing" all at once to 192.168.0.1 - 192.168.0.255
Thanks
Eric
Code: Select all
on scanIPRange pRange
put 1 into x
repeat 255
put (pRange & "." & x) into tMasterIP
probIP tMasterIP
add 1 to x
end repeat
end scanIPRange
Code: Select all
on scanIPRange
open socket to "192.168.0.255:1234"
write "probing" to socket "192.168.0.255:1234"
end scanIPRange
I did not have any luck with the above code and need more details about how to send "probing" all at once to 192.168.0.1 - 192.168.0.255
Thanks
Eric
Re: Datagram socket correct syntax
Hi!
Did you try a UDP message? As in "open datagram socket"?
Walt
Did you try a UDP message? As in "open datagram socket"?
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Datagram socket correct syntax
Hi Walt, I did change my open socket to open datagram socket with no success.
E
E
Re: Datagram socket correct syntax
ecflyer,
What script are you using on the recieving side?
Broadcasting to ...255 may not work (e.g. on my Macs). It is safer to use a repeat loop. I would also use
This will give Rev some time to do management behind the scenes and it might help.
Best,
Mark
What script are you using on the recieving side?
Broadcasting to ...255 may not work (e.g. on my Macs). It is safer to use a repeat loop. I would also use
Code: Select all
repeat with x= 0 to 254 with messages
-- do somehing
wait 0 millisecs with messages
end repeat
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode