diff --git a/beamer/client/Cargo.toml b/beamer/client/Cargo.toml index 729587b..6eca4c8 100644 --- a/beamer/client/Cargo.toml +++ b/beamer/client/Cargo.toml @@ -6,3 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +semserialize = {path='../libs/semserialize'} +postcard = "1.0.0" +serde = { version = "1.0.*"} +argh = "0.1.13" diff --git a/beamer/client/src/main.rs b/beamer/client/src/main.rs index e7a11a9..222b034 100644 --- a/beamer/client/src/main.rs +++ b/beamer/client/src/main.rs @@ -1,3 +1,24 @@ -fn main() { - println!("Hello, world!"); + +use semserialize::SemLine; +use serde::{Serialize, Deserialize}; +use postcard::{from_bytes}; + +use argh::FromArgs; +use std::net; +#[derive(FromArgs)] +///Config options for the client +struct Config { +///listener IP, defaults to 0.0.0.0 +#[argh(option, default = "String::from(\"0.0.0.0\")",short='i')] +ip: String, +///listener port +#[argh(option, default = "2137",short='p')] +udpport: usize, +} +fn main() { + let config:Config = argh::from_env(); + println!("UDP listener Port is {}",config.udpport); + let socket_addr:std::net::SocketAddr = format!("{}:{}",config.ip,config.udpport).parse::().unwrap_or("0.0.0.0:2137".parse::().unwrap()); + let udpsocket = std::net::UdpSocket::bind(socket_addr).expect("couldn't bind to address"); + } diff --git a/beamer/libs/semserialize/shell.nix b/beamer/libs/semserialize/shell.nix index 0e480ce..e0b545f 100644 --- a/beamer/libs/semserialize/shell.nix +++ b/beamer/libs/semserialize/shell.nix @@ -11,6 +11,7 @@ let rust-toolchain = with pkgs; symlinkJoin { ]; }; in pkgs.mkShell { + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; buildInputs = [rust-toolchain]; RUST_BACKTRACE = 1; }