Modify

#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 by Jpm, on May 1, 2009 at 7:44:20 PM

Description: modified (diff)

comment:2 by Valik, on May 3, 2009 at 5:59:01 PM

Owner: set to Valik
Status: newassigned
Type: BugFeature Request
Version: 3.3.0.0

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.

comment:3 by Jpm, on May 5, 2009 at 8:04:48 AM

Why not to use the fact that the IP use 255 instead of adding a new parameter.

comment:4 by Jpm, on May 5, 2009 at 9:30:01 AM

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()

in reply to:  3 comment:5 by Valik, on May 5, 2009 at 4:20:48 PM

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 by skyteddy, on May 31, 2009 at 8:24:20 AM

Can anybody tell me what will happen with this bug/feature request?

Thank you!
R@iner

in reply to:  6 comment:7 by Valik, on May 31, 2009 at 8:33:38 AM

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 Jpm, on Jun 8, 2009 at 6:21:03 PM

Milestone: 3.3.1.1
Owner: changed from Valik to Jpm
Resolution: Completed
Status: assignedclosed

Added in version: 3.3.1.1

Modify Ticket

Action
as closed The owner will remain Jpm.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.