Pass raw frame text over UDP.

This commit is contained in:
mattbk
2025-09-28 21:47:26 -05:00
parent 3aa395dc4e
commit 8065fcc24e

View File

@@ -400,8 +400,9 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
// Send UDP // Send UDP
let uaddr = format!("{}:{}", cli.uip, cli.uport); let uaddr = format!("{}:{}", cli.uip, cli.uport);
let socket = UdpSocket::bind("0.0.0.0:0"); let socket = UdpSocket::bind("0.0.0.0:0");
let message = "Packet received"; //let message = "Packet received";
socket.expect("REASON").send_to(message.as_bytes(), uaddr); let message = &text;
let _ = socket.expect("REASON").send_to(message.as_bytes(), uaddr);
// In non-debug mode, print the session line and any additional lines. // In non-debug mode, print the session line and any additional lines.
if !cli.debug { if !cli.debug {
@@ -422,9 +423,9 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
fn main() -> Result<()> { fn main() -> Result<()> {
let cli = Cli::parse(); let cli = Cli::parse();
let addr = format!("{}:{}", cli.ip, cli.port); let addr = format!("{}:{}", cli.ip, cli.port);
//let uaddr = format!("{}:{}", cli.uip, cli.uport); let uaddr = format!("{}:{}", cli.uip, cli.uport);
let reconnect_delay_ms = 5000; let reconnect_delay_ms = 5000;
/*
if cli.udp { if cli.udp {
// Bind the client socket to any available address and port // Bind the client socket to any available address and port
let socket = UdpSocket::bind("0.0.0.0:0")?; let socket = UdpSocket::bind("0.0.0.0:0")?;
@@ -432,9 +433,7 @@ fn main() -> Result<()> {
// Send a message to the server // Send a message to the server
let message = "UDP client connected"; let message = "UDP client connected";
socket.send_to(message.as_bytes(), uaddr)?; socket.send_to(message.as_bytes(), uaddr)?;
//println!("Sent message to {}: {}", uaddr, message);
} }
*/
loop { loop {
println!("Connecting to AGWPE server at {addr}"); println!("Connecting to AGWPE server at {addr}");