Struct lazy_socket::raw::Socket [] [src]

pub struct Socket { /* fields omitted */ }

Raw socket

Methods

impl Socket
[src]

Initializes new socket.

Corresponds to C connect()

Returns underlying socket descriptor.

Note: ownership is not transferred.

Retrieves socket name i.e. address

Wraps getsockname()

Available for binded/connected sockets.

Binds socket to address.

Listens for incoming connections on this socket.

Receives some bytes from socket

Number of received bytes is returned on success

Receives some bytes from socket

Number of received bytes and remote address are returned on success.

Sends some bytes through socket.

Number of sent bytes is returned.

Sends some bytes through socket toward specified peer.

Number of sent bytes is returned.

Note: the socket will be bound, if it isn't already. Use method name to determine address.

Accept a new incoming client connection and return its files descriptor and address.

This is an emulation of the corresponding Unix system call, that will automatically call .set_blocking and .set_inheritable with parameter values based on the value of flags on the created client socket:

  • AcceptFlags::NON_BLOCKING – Mark the newly created socket as non-blocking
  • AcceptFlags::NON_INHERITABLE – Mark the newly created socket as not inheritable by client processes

Accepts incoming connection.

Connects socket with remote address.

Retrieves socket option.

Sets socket option

Value is generally integer or C struct.

Sets I/O parameters of socket.

It uses ioctlsocket under hood.

Sets non-blocking mode.

Sets whether this socket will be inherited by child processes or not.

Internally this implemented by calling SetHandleInformation(sock, HANDLE_FLAG_INHERIT, …).

Returns whether this socket will be inherited by child processes or not.

Stops receive and/or send over socket.

Closes socket.

Note: on Drop socket will be closed on its own. There is no need to close it explicitly.

Trait Implementations

impl Drop for Socket
[src]

A method called when the value goes out of scope. Read more

impl AsRawSocket for Socket
[src]

Extracts the underlying raw socket from this object.

impl FromRawSocket for Socket
[src]

Creates a new I/O object from the given raw socket. Read more

impl IntoRawSocket for Socket
[src]

Consumes this object, returning the raw underlying socket. Read more