summaryrefslogtreecommitdiffstats
path: root/vendor/hermit-abi/src/tcplistener.rs
blob: 5afe67364b0e1863373d6c26aa9a80dac42045f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! `tcplistener` provide an interface to establish tcp socket server.

use crate::{Handle, IpAddress};

extern "Rust" {
	fn sys_tcp_listener_accept(port: u16) -> Result<(Handle, IpAddress, u16), ()>;
}

/// Wait for connection at specified address.
#[inline(always)]
pub fn accept(port: u16) -> Result<(Handle, IpAddress, u16), ()> {
	unsafe { sys_tcp_listener_accept(port) }
}