mirror of
				https://gitea.farpn.net/w1cdn/mwtchahrd.git
				synced 2025-11-04 05:46:36 -06:00 
			
		
		
		
	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
 | 
			
		||||
    let uaddr = format!("{}:{}", cli.uip, cli.uport);
 | 
			
		||||
    let socket = UdpSocket::bind("0.0.0.0:0");
 | 
			
		||||
    let message = "Packet received";
 | 
			
		||||
    socket.expect("REASON").send_to(message.as_bytes(), uaddr);
 | 
			
		||||
    //let message = "Packet received";
 | 
			
		||||
    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.
 | 
			
		||||
    if !cli.debug {
 | 
			
		||||
@@ -422,9 +423,9 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
 | 
			
		||||
fn main() -> Result<()> {
 | 
			
		||||
    let cli = Cli::parse();
 | 
			
		||||
    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;
 | 
			
		||||
/*    
 | 
			
		||||
    
 | 
			
		||||
    if cli.udp {
 | 
			
		||||
        // Bind the client socket to any available address and port
 | 
			
		||||
        let socket = UdpSocket::bind("0.0.0.0:0")?;
 | 
			
		||||
@@ -432,9 +433,7 @@ fn main() -> Result<()> {
 | 
			
		||||
        // Send a message to the server
 | 
			
		||||
        let message = "UDP client connected";
 | 
			
		||||
        socket.send_to(message.as_bytes(), uaddr)?;
 | 
			
		||||
        //println!("Sent message to {}: {}", uaddr, message);
 | 
			
		||||
    }
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
    loop {
 | 
			
		||||
        println!("Connecting to AGWPE server at {addr}");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user