forked from n6cta/mwtchahrd
Pass raw frame text over UDP.
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -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}");
|
||||||
|
Reference in New Issue
Block a user