Skip to content

Commit

Permalink
Add option to specify the address the socket listens on
Browse files Browse the repository at this point in the history
  • Loading branch information
Kogepan229 committed Feb 3, 2025
1 parent 8b2ed8a commit f5a92ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Args {
args: String,

/// log level (error, warn, info, debug, trace, off)
#[arg(short = 'l', long, default_value = "info")]
#[arg(long, default_value = "info")]
log: String,

/// Print executed opcode
Expand All @@ -43,6 +43,10 @@ struct Args {
#[arg(short = 'w', long)]
wait_start: bool,

/// The address the socket listens on
#[arg(short = 'l', long, default_value = "127.0.0.1")]
listen_address: String,

#[arg(short, long, default_value = "12345")]
port: u16,
}
Expand All @@ -60,7 +64,7 @@ fn main() {

#[cfg(not(test))]
if args.socket {
cpu.connect_socket(&format!("127.0.0.1:{}", args.port)).unwrap();
cpu.connect_socket(&format!("{}:{}", args.listen_address, args.port)).unwrap();
}

elf::load(args.elf, &mut cpu, args.args);
Expand Down

0 comments on commit f5a92ef

Please sign in to comment.