|
Sponge
CS144's user-space TCP library
|
Go to the documentation of this file.
14 sock3.write(
"hi there");
23 sock3.shutdown(SHUT_RDWR);
TCPSocket accept()
Accept a new incoming connection.
A wrapper around TCP sockets.
size_t write(const char *str, const bool write_all=true)
Write a string, possibly blocking until all is written.
void close()
Close the underlying file descriptor.
std::string read(const size_t limit=std::numeric_limits< size_t >::max())
Read up to limit bytes.
Wrapper around IPv4 addresses and DNS operations.
void bind(const Address &address)
Bind a socket to a specified address with bind(2), usually for listen/accept.
void listen(const int backlog=16)
Mark a socket as listening for incoming connections.
void connect(const Address &address)
Connect a socket to a specified peer address with connect(2).