pub struct TcpSocket {
pub(in sys) inet_version: InetVersion,
pub(in sys) descriptor: SafeDescriptor,
}
Expand description
A TCP socket.
Do not use this class unless you need to change socket options or query the state of the socket prior to calling listen or connect. Instead use either TcpStream or TcpListener.
Fields§
§inet_version: InetVersion
§descriptor: SafeDescriptor
Implementations§
source§impl TcpSocket
impl TcpSocket
pub fn bind<A: ToSocketAddrs>(&mut self, addr: A) -> Result<()>
pub fn connect<A: ToSocketAddrs>(self, addr: A) -> Result<TcpStream>
pub fn listen(self) -> Result<TcpListener>
sourcepub fn local_port(&self) -> Result<u16>
pub fn local_port(&self) -> Result<u16>
Returns the port that this socket is bound to. This can only succeed after bind is called.
Trait Implementations§
source§impl AsRawDescriptor for TcpSocket
impl AsRawDescriptor for TcpSocket
source§fn as_raw_descriptor(&self) -> RawDescriptor
fn as_raw_descriptor(&self) -> RawDescriptor
Returns the underlying raw descriptor. Read more
Auto Trait Implementations§
impl RefUnwindSafe for TcpSocket
impl Send for TcpSocket
impl Sync for TcpSocket
impl Unpin for TcpSocket
impl UnwindSafe for TcpSocket
Blanket Implementations§
source§impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
impl<T> AsRawDescriptors for Twhere
T: AsRawDescriptor,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more