pub struct Soc { /* private fields */ }
Expand description
Handle to the Network Socket service.
Implementations§
source§impl Soc
impl Soc
sourcepub fn init_with_buffer_size(num_bytes: usize) -> Result<Self>
pub fn init_with_buffer_size(num_bytes: usize) -> Result<Self>
sourcepub fn host_address(&self) -> Ipv4Addr
pub fn host_address(&self) -> Ipv4Addr
Returns the local IP Address of the Nintendo 3DS system.
§Example
use ctru::services::soc::Soc;
let soc = Soc::new()?;
let address = soc.host_address();
sourcepub fn redirect_to_3dslink(&mut self, stdout: bool, stderr: bool) -> Result<()>
pub fn redirect_to_3dslink(&mut self, stdout: bool, stderr: bool) -> Result<()>
Redirect output streams (i.e. stdout
and stderr
) to the 3dslink
server.
With this redirection it is possible to send (and view in real time) the output of stdout
operations,
such as println!
or dbg!
.
Requires 3dslink
>= 0.6.1 and new-hbmenu
>= 2.3.0 and the use of the --server
flag.
The --server
flag is also availble to use via cargo-3ds
if the requirements are met.
§Errors
Returns an error if a connection cannot be established to the server, or if the output was already being redirected.
§Example
use ctru::services::soc::Soc;
let mut soc = Soc::new()?;
// Redirect to the `3dslink` server that sent this program.
let address = soc.redirect_to_3dslink(true, true)?;
println!("I'm visible from a PC!");