pub struct Socket { /* private fields */ }
This is supported on crate feature rfcomm only.
Expand description

An RFCOMM socket that has not yet been converted to a Listener or Stream.

The primary use of this is to configure the socket before connecting or listening.

Implementations

Creates a new socket of stream type.

Convert the socket into a Listener.

backlog defines the maximum number of pending connections are queued by the operating system at any given time.

This will not register an SDP record for this channel. Register a Bluetooth RFCOMM profile instead, if you need a service record.

Establish a stream connection with a peer at the specified socket address.

This requires knowledge of the channel number. Register a Bluetooth RFCOMM profile, if you need to discover the channel number using a service record.

Bind the socket to the given address.

Get the local address of this socket.

Get socket security.

This corresponds to the BT_SECURITY socket option.

Set socket security.

This corresponds to the BT_SECURITY socket option.

Gets the maximum socket receive buffer in bytes.

This corresponds to the SO_RCVBUF socket option.

Sets the maximum socket receive buffer in bytes.

This corresponds to the SO_RCVBUF socket option.

Gets the RFCOMM socket connection information.

This corresponds to the RFCOMM_CONNINFO socket option.

Gets whether the RFCOMM socket is the master.

This corresponds to the RFCOMM_LM socket option and option bit RFCOMM_LM_MASTER.

sets whether the RFCOMM socket is the master.

This corresponds to the RFCOMM_LM socket option and option bit RFCOMM_LM_MASTER.

Get the number of bytes in the input buffer.

This corresponds to the TIOCINQ IOCTL.

Get the number of bytes in the output buffer.

This corresponds to the TIOCOUTQ IOCTL.

Creates a TTY (virtual serial port) for this RFCOMM connection.

Set dev_id to -1 to automatically allocate an id. Returns the allocated device id.

This corresponds to the RFCOMMCREATEDEV IOCTL.

Releases a TTY (virtual serial port) for this RFCOMM connection.

This corresponds to the RFCOMMRELEASEDEV IOCTL.

Constructs a new Socket from the given raw file descriptor.

The file descriptor must have been set to non-blocking mode.

This function consumes ownership of the specified file descriptor. The returned object will take responsibility for closing it when the object goes out of scope.

Safety

If the passed file descriptor is invalid, undefined behavior may occur.

Trait Implementations

Extracts the raw file descriptor. Read more

Performs the conversion.

Performs the conversion.

Formats the value using the given formatter. Read more

Constructs a new instance of Self from the given raw file descriptor.

The file descriptor must have been set to non-blocking mode.

Panics

Panics when the conversion fails. Use Socket::from_raw_fd for a non-panicking variant.

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.