Index wasi args_get args_sizes_get clock_res_get clock_time_get environ_get environ_sizes_get fd_advise fd_allocate fd_close fd_datasync fd_fdstat_get fd_fdstat_set_flags fd_fdstat_set_rights fd_filestat_get fd_filestat_set_size fd_filestat_set_times fd_pread fd_prestat_dir_name fd_prestat_get fd_pwrite fd_read fd_readdir fd_renumber fd_seek fd_sync fd_tell fd_write file_stat_flags filestat iovec lookup_flags path_create_directory path_filestat_get path_filestat_set_times path_link path_open path_readlink path_remove_directory path_rename path_symlink path_unlink_file poll_oneoff proc_exit proc_raise random_get sched_yield sock_accept sock_recv sock_send sock_shutdown
Send a message on a socket
sock_send (
sock: i32The file descriptor of the socket to send onsi_data: i32A list of scatter/gather vectors containing the data to be sentsi_data_len: i32The length of the scatter/gather vector listsi_flags: i32Message flagsret_data_len: i32A pointer to store the number of bytes transmitted
) =>
error: i32 

The sock_send() function is used to send a message on a socket. It is similar to the send function in POSIX, but it also supports writing the data from multiple buffers in the manner of writev.

The function sends a message using the provided scatter/gather vectors. It retrieves the data from the buffers specified by the scatter/gather vectors and transmits it on the socket. The number of bytes transmitted is returned.

Notes

  • The sock_send() function sends a message on a socket using the provided scatter/gather vectors.
  • The function supports writing the data from multiple buffers.
  • The si_data parameter represents a list of scatter/gather vectors, where each vector contains a buffer and its length.
  • The si_data_len parameter specifies the length of the scatter/gather vector list.
  • The data to be sent is retrieved from the buffers specified by the scatter/gather vectors.
  • The number of bytes transmitted is stored in ret_data_len.
  • The specific behavior of the sock_send() function may vary depending on the runtime environment and underlying networking implementation.

Read More