|
Post by pandawdy on Jul 5, 2019 11:58:01 GMT -5
Anyone know of something like mesock32 that can handle UDP?
|
|
|
Post by pandawdy on Jul 5, 2019 16:21:47 GMT -5
I may have found a much easier way to send messages over UDP. Is there a way to pass information on to the command line from Liberty Basic? I can use the ECHO command with NCAT to send a message to a specific IP and port over UDP.
|
|
|
Post by tsh73 on Jul 5, 2019 16:26:29 GMT -5
see RUN in a help file
|
|
|
Post by pandawdy on Jul 5, 2019 18:03:12 GMT -5
Thank you. It didn't work exactly as expected due to ECHO. But I think I can write a batch file instead and then execute the batch file instead of passing data direct to the command prompt. Is there a way to kill a running program?
|
|
|
Post by pandawdy on Jul 7, 2019 8:42:35 GMT -5
Hope you guys don't mind me posting here.
I found a better solution on the LB Yahoo Group. Tested and it seems to work.
open "WS2_32" for DLL as #winsock packet$ = "Hello world!" ok = UDPsend("98.137.246.8", 16000, packet$) if ok then print "Packet sent" else print "UDPsend failed" close #winsock end
function UDPsend(addr$, port, msg$) AF.INET = 2 SOCK.DGRAM = 2 IPPROTO.UDP = 17 UDPsend = 0 port = (port and hexdec("FF00")) / 256 + (port and 255) * 256 ' swap bytes calldll #winsock, "inet_addr", addr$ as ptr, ipaddr as ulong struct WSAdata, d as char[398] calldll #winsock, "WSAStartup", 514 as long, WSAdata as struct, ret as long if ret then exit function calldll #winsock, "socket", AF.INET as long, SOCK.DGRAM as long, _ IPPROTO.UDP as long, socket as long if socket = -1 then exit function struct addr, family as short, port as short, addr as ulong, zero as char[8] addr.family.struct = AF.INET addr.port.struct = port addr.addr.struct = ipaddr al = len(addr.struct) ml = len(msg$) calldll #winsock, "sendto", socket as long, msg$ as ptr, ml as long, _ 0 as long, addr as struct, al as long, sent as long calldll #winsock, "closesocket", socket as long, ret as long calldll #winsock, "WSACleanup", ret as long if sent = ml then UDPsend = 1 end function
|
|
|
Post by Rod on Jul 7, 2019 11:38:24 GMT -5
We are one group, share whatever you find.
|
|
Sver
Full Member
Posts: 145
|
Post by Sver on Oct 16, 2019 13:48:10 GMT -5
Works !
Easy to test with : UDP Terminal (mightyT) in the Play store. For me, a lower port works ok.
|
|