Lecdev Posted February 5, 2018 Share Posted February 5, 2018 Ive spent a few hours reading threads dating back years to do with udp multicast. none of them seem to have ever been resolved. am i wasting my time trying to find a working solution to bind and use udp multicast addresses for example 239.xyz.xyz.xyz on a network to communicate to and from scripts on diferent computers using autoit? its a real bummer if its not possible. Link to comment Share on other sites More sharing options...
Andreik Posted February 5, 2018 Share Posted February 5, 2018 It shouldn't be a problem using WinAPI instead of native AutoIt functions. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Lecdev Posted February 5, 2018 Author Share Posted February 5, 2018 yeah i thought as much but i also thought if i did it from scratch myself it would be an endeavor of which the end would not be reached before the time i need something running unless its already been solved by someone. Link to comment Share on other sites More sharing options...
Andreik Posted February 5, 2018 Share Posted February 5, 2018 Some work has been already done. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
nend Posted February 5, 2018 Share Posted February 5, 2018 (edited) I don't know if you meant this? expandcollapse popup;--- Client --- TCPStartup() Local $sendstring = "Find_led" ConsoleWrite(_get_server_ip($sendstring) Func _get_server_ip($sendstring) Local $data, $count, $count_total UDPStartup() Local $socket_send = UDPOpen(StringRegExpReplace(@IPAddress1, "(\d+)$", "") & "255", 6666) Local $socket_recieve = UDPBind(@IPAddress1, 7777) If UDPSend($socket_send, $sendstring) = 0 then SetError(1); Else While 1 If $count_total > 20 Then SetError(2) ExitLoop EndIf If $count > 5 Then If UDPSend($socket_send, $sendstring) = 0 then SetError(1); ExitLoop EndIf $count = 0 EndIf $data = UDPRecv($socket_recieve, 50) If $data <> "" Then ExitLoop EndIf $count = $count + 1 $count_total = $count_total + 1 Sleep(100) WEnd EndIf UDPCloseSocket($socket_send) UDPCloseSocket($socket_recieve) UDPShutdown() Return $data EndFunc ;--- Server --- TCPStartup() $socket_recieve = UDPBind(@IPAddress1, 6666) While 1 $data = UDPRecv($socket_recieve, 50) If $data <> "" Then If $data = "Find_led" Then $socket_send = UDPOpen("192.168.0.255", 7777) $status = UDPSend($socket_send, @IPAddress1) UDPCloseSocket($socket_send) EndIf EndIf WEnd This is a bit of code (of a much larger project) I used to get the ipadres of a server by UDP muliticast. This is a piece of code and didn't test this pieces so it's possible it won't work correctly. Edited February 5, 2018 by nend Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now