So I'm trying to make something that involves UDP for certain things. I have been at this all day and I'm not sure what might be the issue here. I've attempted to distill this down to just listening on a port and spitting out whatever text is sent. I keep getting invalid memory access.
Code: Select all
; handwritten UDP mini
#ADDR = "127.0.0.1"
#PORT = 5556
#BUFFER_SIZE = 1024
*buffer = AllocateMemory(#BUFFER_SIZE)
socket = CreateNetworkServer(#PB_Any, #PORT, #PB_Network_UDP)
Repeat
event = NetworkServerEvent()
If event = #PB_NetworkEvent_Data
bytes = ReceiveNetworkData(socket, *buffer, #BUFFER_SIZE)
message.s = PeekS(*buffer, bytes)
Debug message
Debug Str(bytes)
EndIf
Delay(10)
ForEverCode: Select all
echo -n "JOIN lab1 ALL 127.0.0.1" | nc -u 127.0.0.1 5556I'm running Kubuntu 25.04, but everything else as far as purebasic goes seems to work just fine. If anyone has any clues I'd appreciate it. Though part of me suspects its a case of I overlooked something again.

