Jump to content

urmilparikh

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by urmilparikh

  1. For records, I've filed a new feature request: https://www.autoitscript.com/trac/autoit/ticket/3525
  2. Hi @nend, your example listens to the broadcast group of your subnet (IP x.y.z.255, if I'm correct). For the devices I'm working with, they emit a discovery beacon on fixed multicast IP address and port. I've a working code for node.js that binds to port 9131 and then joins to multicast group: // Create UDP socket const dgram = require('dgram'); var sock = dgram.createSocket('udp4'); // Bind to port sock.bind(9131, function() { // Join multicast group sock.addMembership('239.255.250.250'); }); // Wait for messages sock.on('message', function(msg, rinfo) { msg = msg.toString(); console.log(msg); }); I'm able to receive messages with this code. I hope something similar is available in AutoIt that I can make in to a simple GUI.
  3. Oh, I looked more and found that UDPBind() returns error 10049 - invalid address. That makes me think, AutoIt doesn't have support for listening for UDP multicast packets???
  4. I'm facing a similar issue. I want to bind to UDP multicast address 239.255.250.250 on port 9131. I get an error 10049 with `UDPBind("239.255.250.250", 9131)`. I do not see any option to specify that it is a multicast address. I'm stuck here.
  5. According to a comment here: http://stackoverflow.com/questions/20289986/upnp-envelopes-from-scratch-not-really-working I thought AutoIt does that for me, but possibly it doesn't. So, I need to bind to my local port and join the multicast group. But, I do not see nay function to join to a multicast group?
  6. This is interesting. I changed the port to my local IP, and on running the code, Windows asked me for some network related permission for AutoIt. After approval, I could receive packet sent to my local IP (over UDP). So, all these time when I was using multicast IP, AutoIt never tried binding to it. Even after changing IP back to multicast IP, it is not binding. Does this give any hint?
  7. Hi @dmob, I started with different ports. In the code that I shared, even if I disable the send part, I do not seem to receive any UDP packets sent by other senders. I added send part with same port just to confirm that multicast sending is working - and try to do a loop-back.
  8. I have this code, where I listen using one socket and send a packet using another one, both in same program. Receive doesn't seem to work, I checked with Wireshark that send happens. Am I missing something? #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Create GUI Local $w = 400 Local $h = 200 Local $b = 3 GUICreate("Local Discovery", $w, $h) Local $idListView = GUICtrlCreateListView("UUID|IP|", $b, $b, $w - 2 * $b, $h - 2 * $b) ;GUICtrlSetTip(-1, '#Region LIST VIEW') ; Start the UDP service. UDPStartup() OnAutoItExitRegister("OnAutoItExit") ; Start listener Local $msg = "" Local $recv = UDPBind("239.255.250.250", 9130) ; Query widgets Local $send = UDPOpen("239.255.250.250", 9130, $UDP_OPEN_BROADCAST ) UDPSend($send, "Hello") UDPCloseSocket($send) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton") GUISetState(@SW_SHOW) While 1 $msg = UDPRecv($recv, 512) If $msg <> "" Then ConsoleWrite($msg) GUICtrlCreateListViewItem("A|One", $idListView) EndIf Sleep(100) WEnd Func CLOSEButton() Exit EndFunc Func OnAutoItExit() ; Close the UDP service. UDPShutdown() EndFunc
×
×
  • Create New...