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;
67 WvTCPConn(WvStringParm _hostname, uint16_t _port = 0);
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"; }
virtual const WvIPPortAddr * src() const
return the remote address (source of all incoming packets), which is a constant for any given TCP con...
void low_delay()
function to set up a TCP socket the way we like In addition to the nice_tcpopts(),...
WvTCPConn(int _fd, const WvIPPortAddr &_remaddr)
Start a WvTCPConn on an already-open socket (used by WvTCPListener)
virtual bool isok() const
Is this connection OK? Note: isok() will always be true if !resolved, even though fd==-1.
ASynchronous DNS resolver functions, so that we can do non-blocking lookups.
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...
Class to easily create the Server side of a WvTCPConn.
WvTCPConn tries to make all outgoing connections asynchronously (in the background).
WvString is an implementation of a simple and efficient printable-string class.
void nice_tcpopts()
function to set up a TCP socket the way we like (Read/Write, Non-Blocking, KeepAlive)
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
void check_resolver()
Resolve the remote address, if it was fed in non-IP form.
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...
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?
WvIPPortAddr localaddr()
the local address of this socket (ie.
Base class for streams built on Unix file descriptors.
WvString hostname()
Do gethostname() without a fixed-length buffer.
virtual bool post_select(SelectInfo &si)
override post_select() to set the 'connected' variable as soon as we are connected.