#pragma once12#include <cstring>3#include <string>45namespace fd_util {67// Slow as hell and should only be used for prototyping.8size_t ReadLine(int fd, char *buffer, size_t buf_size);910// Decently fast.11size_t WriteLine(int fd, const char *buffer, size_t buf_size);12size_t WriteLine(int fd, const char *buffer);13size_t Write(int fd, const std::string &str);1415// Returns true if the fd became ready, false if it didn't or16// if there was another error.17bool WaitUntilReady(int fd, double timeout, bool for_write = false);1819void SetNonBlocking(int fd, bool non_blocking);2021std::string GetLocalIP(int sock);2223} // fd_util242526