10 #include "wvautoconf.h" 13 # include <sys/types.h> 24 # include <sys/socket.h> 27 #include "wvfdstream.h" 29 #include "wvresolver.h" 43 bool resolved, connected;
108 {
return connected; }
123 virtual bool isok()
const;
126 virtual size_t uwrite(
const void *buf,
size_t count);
129 const char *wstype()
const {
return "WvTCPConn"; }
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
void check_resolver()
Resolve the remote address, if it was fed in non-IP form.
bool isconnected() const
has the connection been completed yet?
WvIPPortAddr localaddr()
the local address of this socket (ie.
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy.zzz:pppp.
WvTCPConn(int _fd, const WvIPPortAddr &_remaddr)
Start a WvTCPConn on an already-open socket (used by WvTCPListener)
virtual bool post_select(SelectInfo &si)
override post_select() to set the 'connected' variable as soon as we are connected.
virtual void pre_select(SelectInfo &si)
override pre_select() to cause select() results when resolving names.
void debug_mode()
function to set up a TCP socket the way we don't like: turn the timeouts way down so that network err...
Class to easily create the Server side of a WvTCPConn.
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
ASynchronous DNS resolver functions, so that we can do non-blocking lookups.
void nice_tcpopts()
function to set up a TCP socket the way we like (Read/Write, Non-Blocking, KeepAlive) ...
the data structure used by pre_select()/post_select() and internally by select(). ...
WvTCPConn tries to make all outgoing connections asynchronously (in the background).
Base class for streams built on Unix file descriptors.
void do_connect()
Connect to the remote end - note the "Protected" above ;)
virtual ~WvTCPConn()
Destructor - rarely do you need to call this - close() is a much better way to tear down a TCP Stream...
WvString hostname()
Do gethostname() without a fixed-length buffer.
virtual bool isok() const
Is this connection OK? Note: isok() will always be true if !resolved, even though fd==-1...
virtual const WvIPPortAddr * src() const
return the remote address (source of all incoming packets), which is a constant for any given TCP con...
WvString is an implementation of a simple and efficient printable-string class.
void low_delay()
function to set up a TCP socket the way we like In addition to the nice_tcpopts(), set TCP_NODELAY