I am attempting to write a simple interface to a server I wrote that uses UDP style sockets. I just need to be able to send and receive a bit of text from a given IP and port number, and display the input text in a formatted way. As of right now, I am having troubles with getting the PacketPeerUDP object to work how I want it to, and am not sure if it is the correct way to go about it.
The code:
var IP_SERVER = "127.0.0.1"
var PORT_SERVER = 70
var PORT_CLIENT = 70
var socketUDP = PacketPeerUDP.new()
func _ready():
var socket = PacketPeerUDP.new()
socket.set_broadcast_enabled(true)
socket.set_dest_address(IP_SERVER, PORT_SERVER)
socket.put_packet("about.txt".to_ascii())
print("Sent package.")
As of right now, whenever I run it, it does get to the point that it prints out the "Sent package" message, but on the server I am running, it does not get any input. One thing that I have tried is closing the socket after sending the packet, but that does not fix the issue.