pub fn allocate_socket(&mut self) -> Result<(), Error<TcpStack::Error>> {
        if let Some(socket) = self.socket.take() {
            self.network_stack
                .close(socket)
                .map_err(|err| Error::Network(err))?;
        }

        // Allocate a new socket to use and begin connecting it.
        self.socket.replace(
            self.network_stack
                .socket()
                .map_err(|err| Error::Network(err))?,
        );

        Ok(())
    }
/// Allocate a new TCP socket.
///
/// # Note
/// If a TCP socket was previously open, it will be closed and a new socket will be allocated.
Allocate a new TCP socket.
Allocate a new TCP socket .
pub fn allocate_socket(&mut self) -> Result<(), Error<TcpStack::Error>> {
        if let Some(socket) = self.socket.take() {
            self.network_stack
                .close(socket)
                .map_err(|err| Error::Network(err))?;
        }
        // Allocate a new socket to use and begin connecting it.
        self.socket.replace(
            self.network_stack
                .socket()
                .map_err(|err| Error::Network(err))?,
        );
        Ok(())
    }
pub fn allocate_socket ( & mut self ) -> Result < ( ) , Error < TcpStack :: Error > > { if let Some ( socket ) = self . socket . take ( ) { self . network_stack . close ( socket ) . map_err ( | err | Error :: Network ( err ) ) ? ; } // Allocate a new socket to use and begin connecting it. self . socket . replace ( self . network_stack . socket ( ) . map_err ( | err | Error :: Network ( err ) ) ? , ) ; Ok ( ( ) ) }
Allocate a new TCP socket.
Allocate a new TCP socket .
&mut self
note
If a TCP socket was previously open, it will be closed and a new socket will be allocated.
If a TCP socket was previously open it will be closed and a new socket will be allocated .