txt: ## write.md
  write
  
  Combined from primary sources listed below.
  
  # [In IO::Socket::Async](#___top "go to top of document")[§](#(IO::Socket::Async)_method_write "direct link")
  
  See primary documentation
  [in context](/type/IO/Socket/Async#method_write)
  for **method write**.
  
  ```raku
  method write(IO::Socket::Async:D: Blob $b --> Promise)
  ```
  
  This method will attempt to send the bytes in `$b` on the `IO::Socket::Async` that will have been obtained indirectly via `connect` or `listen`, returning a [`Promise`](/type/Promise) that will be kept with the number of bytes sent or broken if there was an error sending.
  
  # [In IO::Handle](#___top "go to top of document")[§](#(IO::Handle)_method_write "direct link")
  
  See primary documentation
  [in context](/type/IO/Handle#method_write)
  for **method write**.
  
  ```raku
  method write(IO::Handle:D: Blob:D $buf --> True)
  ```
  
  Writes `$buf` to the filehandle. This method can be called even when the handle is not [in binary mode](/type/IO/Handle#method_encoding).
  
  # [In Proc::Async](#___top "go to top of document")[§](#(Proc::Async)_method_write "direct link")
  
  See primary documentation
  [in context](/type/Proc/Async#method_write)
  for **method write**.
  
  ```raku
  method write(Proc::Async:D: Blob:D $b, :$scheduler = $*SCHEDULER --> Promise:D)
  ```
  
  Write the binary data in `$b` to the standard input stream of the external program.
  
  Returns a [`Promise`](/type/Promise) that will be kept once the data has fully landed in the input buffer of the external program.
  
  The `Proc::Async` object must be created for writing (with `Proc::Async.new(:w, $path, @args)`). Otherwise an [`X::Proc::Async::OpenForWriting`](/type/X/Proc/Async/OpenForWriting) exception will the thrown.
  
  `start` must have been called before calling method write, otherwise an [`X::Proc::Async::MustBeStarted`](/type/X/Proc/Async/MustBeStarted) exception is thrown.
  
  # [In role IO::Socket](#___top "go to top of document")[§](#(role_IO::Socket)_method_write "direct link")
  
  See primary documentation
  [in context](/type/IO/Socket#method_write)
  for **method write**.
  
  ```raku
  method write(IO::Socket:D: Blob:D $buf)
  ```
  
  Writes the supplied buffer to the socket, thus sending it to other end of the connection. The string version is [method print](#method_print).
  
  Fails if the socket is not connected.
  