Skip to main content
function Net.try_unix_request
def Net.try_unix_request(
path: str,
/,
*,
send: None | str = None
) -> str
One-shot Unix-domain-socket request/response. Connects to path, writes send if provided, shuts down the write side (so peers that wait for EOF before replying see end-of-stream promptly), reads all bytes until EOF, and returns them as a string. Returns "" on any I/O error (socket missing, connect refused, non-UTF-8 response, transient read failure) so callers can treat “no response” and “error” uniformly without try/except scaffolding. Use a non-empty return as the signal that the peer replied. Unix only — returns "" on other platforms.