Ticket #1206: UDPSend.au3

File UDPSend.au3, 741 bytes (added by MrBeatnik <palebluecreations@…>, 15 years ago)

This is the sending script. Need to change IP address.

Line 
1#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
2#AutoIt3Wrapper_outfile=UDPSend.exe
3#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
4;Set VARS
5        ;Packet Vars
6        global $socketA
7        global $sendIP = "0.0.0.0"                      ;Change to PC IP where script is listening.
8        global $myport = "5001"                         ;Listening port to send to.
9        global $mypacket="hello!"
10
11        ;Form Looping Vars
12        global $loopNum=0,$dataTXT="",$Form1,$Label1
13
14
15;Start App
16        _startup()
17
18        While 1
19                $status = UDPSend($socketA, $mypacket)
20                Sleep(5000)
21        WEnd
22
23
24Func _startup()
25        ;Init UDP
26        UDPStartup()
27
28        ;Open socket to send
29        $socketA = UDPOpen($sendIP, 5001)       
30        If @error <> 0 Then
31                msgbox(0,"Open Error","Error: " & @error)
32                Exit
33        EndIf
34EndFunc