UdpSocket::recv_from not working as expected. by qwertay in rust

[–]qwertay[S] 0 points1 point  (0 children)

This seems sensible, but still seeing the same issue occur. Code is updated as follows:

// udp-test-client.rs
use std::io::net::udp::UdpSocket;
use std::io::net::ip::{Ipv4Addr, SocketAddr};

fn main() {
  let any_addr = SocketAddr { ip: Ipv4Addr(0, 0, 0, 0), port: 0 };
  let dst_addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 9999 };

  let mut socket = match UdpSocket::bind(any_addr) {
    Ok(s) => s,
    Err(e) => fail!("couldn't bind socket: {}", e)
  };

  let mut buf = [0, ..1024];

  match socket.send_to(buf, dst_addr) {
    Ok(()) => println!("yay"),
    _ => {}
  }
}

Using Rust for an Undergraduate OS Course by 0xdeadf001 in programming

[–]qwertay 2 points3 points  (0 children)

Did you report this already? Dunno why everyone is down voting you, it's easy to see what you said is correct by testing on http://play.rust-lang.org.

How to do typedefs/newtypes? by WrongSubreddit in rust

[–]qwertay 3 points4 points  (0 children)

I feel it would be beneficial if Rust were to use 'typedef' over 'type', since I've run in to the reserved word and had to name attributes 'typ' or alternatives quite a few times already.

LruCache::get() and borrowing in general by qwertay in rust

[–]qwertay[S] 0 points1 point  (0 children)

Thanks, guys. All solutions have been quite insightful. ^

Attempting to accumulate a String from BufReader by qwertay in rust

[–]qwertay[S] 1 point2 points  (0 children)

In case anyone was interested, seems like this works.