Opened 17 years ago
Closed 17 years ago
#938 closed Feature Request (Completed)
UDPOpen and/or UDPSend to 255.255.255.255 doesn't work
| Reported by: | skyteddy | Owned by: | J-Paul Mesnage |
|---|---|---|---|
| Milestone: | 3.3.1.1 | Component: | AutoIt |
| Version: | Severity: | None | |
| Keywords: | UDP, UDPOpen, UDPSend, 255.255.255.255 | Cc: |
Description (last modified by )
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 by , 17 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 17 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
| Type: | Bug → Feature Request |
| Version: | 3.3.0.0 |
follow-up: 5 comment:3 by , 17 years ago
Why not to use the fact that the IP use 255 instead of adding a new parameter.
comment:4 by , 17 years ago
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 by , 17 years ago
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.
follow-up: 7 comment:6 by , 17 years ago
Can anybody tell me what will happen with this bug/feature request?
Thank you!
R@iner
comment:7 by , 17 years ago
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 by , 17 years ago
| Milestone: | → 3.3.1.1 |
|---|---|
| Owner: | changed from to |
| Resolution: | → Completed |
| Status: | assigned → closed |
Added in version: 3.3.1.1

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.