Opened 16 years ago
Closed 16 years ago
#938 closed Feature Request (Completed)
UDPOpen and/or UDPSend to 255.255.255.255 doesn't work
Reported by: | skyteddy | Owned by: | Jpm |
---|---|---|---|
Milestone: | 3.3.1.1 | Component: | AutoIt |
Version: | Severity: | None | |
Keywords: | UDP, UDPOpen, UDPSend, 255.255.255.255 | Cc: |
Description (last modified by Jpm)
Hello,
I try to send a message via UDP to the LAN-independent broadcast-IP-address 255.255.255.255, but nothing happens. If I use wireshark for control, I see nothing. It looks like, that AutoIt doesn't send anything. And I don't get any error too. It seems, it works, but it doesn't! It is independet which port I use. And I can't say, if UPPOpen or UDPSend makes the failure, or both.
If I change the broadcast-address to the LAN-specific-address e.g. 192.168.10.255, it works and I see the packets in wireshark. But I need to send the packet to 255.255.255.255 :-)
Global $Port = "5035" Global $BroadcastAdr = "255.255.255.255" ; Global $BroadcastAdr = "192.168.178.255"; Sending and receiving works (netmask = 255.255.255.0) ; Start UDP UDPStartup() If @error <> 0 Then MsgBox(0, "UDP Startup Error", @error, 1) Exit EndIf ; open UDP socket $SendSocket = UDPOpen($BroadcastAdr, $Port) If @error <> 0 Then MsgBox(0, "UDP Open Error (for sending)", @error, 1) Exit EndIf ; Sending $Counter = 1 While $Counter <= 20 $SendStatus = UDPSend($SendSocket, "Hello") If $SendStatus = 0 Then MsgBox(0, "ERROR", "Error while sending UDP message: " & @error) Exit EndIf WEnd ; --- Exit --- Exit Func OnAutoItExit() ; --- Close Sockets --- UDPCloseSocket($SendSocket) ; --- Stop UDP --- UDPShutdown() EndFunc ;==>OnAutoItExit
Details to my problem and a larger example script you will find at:
http://www.autoitscript.com/forum/index.php?showtopic=94048&view=findpost&p=675676
Thanks in advance
R@iner
Attachments (0)
Change History (8)
comment:1 Changed 16 years ago by Jpm
- Description modified (diff)
comment:2 Changed 16 years ago by Valik
- Owner set to Valik
- Status changed from new to assigned
- Type changed from Bug to Feature Request
- Version 3.3.0.0 deleted
comment:3 follow-up: ↓ 5 Changed 16 years ago by Jpm
Why not to use the fact that the IP use 255 instead of adding a new parameter.
comment:4 Changed 16 years ago by Jpm
Just a slight precision the doc is a little bit buggy the return from UDPSend() must be check using @error.
I just update the doc. Same for UDPBind()
comment:5 in reply to: ↑ 3 Changed 16 years ago by Valik
Replying to Jpm:
Why not to use the fact that the IP use 255 instead of adding a new parameter.
It's a SAFETY switch. If we try to auto-detect the switch needs turned off we might as well just turn the switch off permanently. But doing that goes back to the whole reason the switch exists in the first place: To keep users from accidentally flooding the network.
It must be an option the user must choose to call. My only debate is whether this should be implemented via a new function or whether it should be specified at socket creation time. I'm not sure yet which I prefer.
comment:6 follow-up: ↓ 7 Changed 16 years ago by skyteddy
Can anybody tell me what will happen with this bug/feature request?
Thank you!
R@iner
comment:7 in reply to: ↑ 6 Changed 16 years ago by Valik
Replying to skyteddy:
Can anybody tell me what will happen with this bug/feature request?
Thank you!
R@iner
Isn't it clear? I said it would be implemented once a suitable method is found for exposing the option.
comment:8 Changed 16 years ago by Jpm
- Milestone set to 3.3.1.1
- Owner changed from Valik to Jpm
- Resolution set to Completed
- Status changed from assigned to closed
Added in version: 3.3.1.1
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
This is not a bug. This is a lack of feature. Sockets that wish to send broadcast messages must set a specific option. It's a safety feature. AutoIt currently does not allow the "let me broadcast" flag (SO_BROADCAST) to be set.
I'm changing this to a feature request to reflect it's not actually a bug.