Function: set-process-datagram-address

set-process-datagram-address is a function defined in process.c.

Signature

(set-process-datagram-address PROCESS ADDRESS)

Documentation

Set the datagram address for PROCESS to ADDRESS.

Return nil upon error setting address, ADDRESS otherwise.

If PROCESS is a non-blocking network process that hasn't been fully set up yet, this function will block until socket setup has completed.

View in manual

Probably introduced at or before Emacs version 22.1.

Source Code

// Defined in /usr/src/emacs/src/process.c
{
  int channel;
  int family;
  ptrdiff_t len;

  CHECK_PROCESS (process);

  if (NETCONN_P (process))
    wait_for_socket_fds (process, "set-process-datagram-address");

  if (!DATAGRAM_CONN_P (process))
    return Qnil;

  channel = XPROCESS (process)->infd;

  len = get_lisp_to_sockaddr_size (address, &family);
  eassert (0 <= channel && channel < FD_SETSIZE);
  if (len == 0 || datagram_address[channel].len != len)
    return Qnil;
  conv_lisp_to_sockaddr (family, address, datagram_address[channel].sa, len);
  return address;
}