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...
Base class for streams built on Unix file descriptors.
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
ASynchronous DNS resolver functions, so that we can do non-blocking lookups.
WvString is an implementation of a simple and efficient printable-string class.
WvTCPConn tries to make all outgoing connections asynchronously (in the background).
virtual bool isok() const
Is this connection OK? Note: isok() will always be true if !resolved, even though fd==-1.
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...
void low_delay()
function to set up a TCP socket the way we like In addition to the nice_tcpopts(),...
void nice_tcpopts()
function to set up a TCP socket the way we like (Read/Write, Non-Blocking, KeepAlive)
virtual bool post_select(SelectInfo &si)
override post_select() to set the 'connected' variable as soon as we are connected.
void check_resolver()
Resolve the remote address, if it was fed in non-IP form.
virtual ~WvTCPConn()
Destructor - rarely do you need to call this - close() is a much better way to tear down a TCP Stream...
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
bool isconnected() const
has the connection been completed yet?
virtual void pre_select(SelectInfo &si)
override pre_select() to cause select() results when resolving names.
virtual const WvIPPortAddr * src() const
return the remote address (source of all incoming packets), which is a constant for any given TCP con...
void do_connect()
Connect to the remote end - note the "Protected" above ;)
WvIPPortAddr localaddr()
the local address of this socket (ie.
Class to easily create the Server side of a WvTCPConn.
WvString hostname()
Do gethostname() without a fixed-length buffer.