Skip to main content

send_packet

Function send_packet 

Source
pub fn send_packet(
    socket: &Socket,
    packet_buffer: &[u8],
    dst: &Address,
) -> Result<(), Error>
Expand description

Send a packet (vector of bytes) to a destination using the raw socket. IPv4: Send IPv4 header and IP payload IPv6: Send only payload (kernel writes IPv6 header)

The port in the destination SockAddr is ignored for raw sockets (the real destination lives in the IP header we craft), so it is always 0.

ยงArguments

  • socket - attached raw socket to send probes from
  • packet_buffer - Packet to send (as bytes)
  • dst - Destination address to send to