.TH "KExtendedSocket" 3 "28 Jan 2004" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KExtendedSocket \- The extended socket class. an extended socket.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kextsock.h>\fP
.PP
Inherits \fBKBufferedIO\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBFlags\fP { \fBanySocket\fP =  0x00, \fBknownSocket\fP =  0x01, \fBunixSocket\fP =  knownSocket | 0x02, \fBinetSocket\fP =  knownSocket | 0x04, \fBipv4Socket\fP =  inetSocket | 0x100, \fBipv6Socket\fP =  inetSocket | 0x200, \fBpassiveSocket\fP =  0x1000, \fBcanonName\fP =  0x2000, \fBnoResolve\fP =  0x4000, \fBstreamSocket\fP =  0x8000, \fBdatagramSocket\fP =  0x10000, \fBrawSocket\fP =  0x20000, \fBinputBufferedSocket\fP =  0x200000, \fBoutputBufferedSocket\fP =  0x400000, \fBbufferedSocket\fP =  0x600000 }"
.br
.RI "\fIflags that can be passed down to the member functions \fP"
.ti -1c
.RI "enum \fBSockStatus\fP { \fBerror\fP =  -1, \fBnothing\fP =  0, \fBlookupInProgress\fP =  50, \fBlookupDone\fP =  70, \fBcreated\fP =  100, \fBbound\fP =  140, \fBconnecting\fP =  200, \fBconnected\fP =  220, \fBlistening\fP =  200, \fBaccepting\fP =  220, \fBclosing\fP =  350, \fBdone\fP =  400 }"
.br
.RI "\fIstatus of the class The status are sequential. \fP"
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBlookupFinished\fP (int count)"
.br
.RI "\fIThis signal is emitted whenever an asynchronous lookup process is done. \fP"
.ti -1c
.RI "void \fBconnectionSuccess\fP ()"
.br
.RI "\fIThis signal is emitted whenever we connected asynchronously to a host. \fP"
.ti -1c
.RI "void \fBconnectionFailed\fP (int error)"
.br
.RI "\fIThis signal is emitted whenever our asynchronous connection attempt failed to all hosts listed. \fP"
.ti -1c
.RI "void \fBreadyAccept\fP ()"
.br
.RI "\fIThis signal is emitted whenever this socket is ready to accept another socket. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKExtendedSocket\fP ()"
.br
.RI "\fICreates an empty KExtendedSocket. \fP"
.ti -1c
.RI "\fBKExtendedSocket\fP (const  \fBQString\fP &host, int port, int \fBflags\fP=0)"
.br
.RI "\fICreates a socket with the given hostname and port. \fP"
.ti -1c
.RI "\fBKExtendedSocket\fP (const  \fBQString\fP &host, const  \fBQString\fP &service, int \fBflags\fP=0)"
.br
.RI "\fICreates a socket with the given hostname and service. \fP"
.ti -1c
.RI "virtual \fB~KExtendedSocket\fP ()"
.br
.RI "\fIDestroys the socket, disconnecting if still connected and freeing any related resources still being kept. \fP"
.ti -1c
.RI "void \fBreset\fP ()"
.br
.RI "\fIResets the socket, disconnecting if still connected and freeing any related resources still being kept. \fP"
.ti -1c
.RI "int \fBsocketStatus\fP () const "
.br
.RI "\fIReturns the class status. \fP"
.ti -1c
.RI "int \fBsystemError\fP () const "
.br
.RI "\fIReturns the related system error code Except for IO_LookupError errors, these are codes found in errno. \fP"
.ti -1c
.RI "int \fBsetSocketFlags\fP (int \fBflags\fP)"
.br
.RI "\fISets the given flags. \fP"
.ti -1c
.RI "int \fBsocketFlags\fP () const "
.br
.RI "\fIReturns the current flags. \fP"
.ti -1c
.RI "bool \fBsetHost\fP (const  \fBQString\fP &host)"
.br
.RI "\fISets the hostname to the given value. \fP"
.ti -1c
.RI "\fBQString\fP \fBhost\fP () const "
.br
.RI "\fIReturns the hostname. \fP"
.ti -1c
.RI "bool \fBsetPort\fP (int port)"
.br
.RI "\fISets the port/service. \fP"
.ti -1c
.RI "bool \fBsetPort\fP (const  \fBQString\fP &service)"
.br
.RI "\fISets the port/service. \fP"
.ti -1c
.RI "\fBQString\fP \fBport\fP () const "
.br
.RI "\fIReturns the port/service. \fP"
.ti -1c
.RI "bool \fBsetAddress\fP (const  \fBQString\fP &host, int port)"
.br
.RI "\fISets the address where we will connect to. \fP"
.ti -1c
.RI "bool \fBsetAddress\fP (const  \fBQString\fP &host, const  \fBQString\fP &serv)"
.br
.RI "\fISets the address where we will connect to. \fP"
.ti -1c
.RI "bool \fBsetBindHost\fP (const  \fBQString\fP &host)"
.br
.RI "\fISets the hostname to which we will bind locally before connecting. \fP"
.ti -1c
.RI "bool \fBunsetBindHost\fP ()"
.br
.RI "\fIUnsets the bind hostname. \fP"
.ti -1c
.RI "\fBQString\fP \fBbindHost\fP () const "
.br
.RI "\fIReturns the hostname to which the socket will be/is bound. \fP"
.ti -1c
.RI "bool \fBsetBindPort\fP (int port)"
.br
.RI "\fISets the port/service to which we will bind before connecting. \fP"
.ti -1c
.RI "bool \fBsetBindPort\fP (const  \fBQString\fP &service)"
.br
.RI "\fISets the port/service to which we will bind before connecting. \fP"
.ti -1c
.RI "bool \fBunsetBindPort\fP ()"
.br
.RI "\fIUnsets the bind port/service. \fP"
.ti -1c
.RI "\fBQString\fP \fBbindPort\fP () const "
.br
.RI "\fIReturns the service to which the socket will be/is bound. \fP"
.ti -1c
.RI "bool \fBsetBindAddress\fP (const  \fBQString\fP &host, int port)"
.br
.RI "\fISets both host and port to which we will bind the socket. \fP"
.ti -1c
.RI "bool \fBsetBindAddress\fP (const  \fBQString\fP &host, const  \fBQString\fP &service)"
.br
.RI "\fISets both host and service to which we will bind the socket. \fP"
.ti -1c
.RI "bool \fBunsetBindAddress\fP ()"
.br
.RI "\fIUnsets the bind address for the socket. \fP"
.ti -1c
.RI "bool \fBsetTimeout\fP (int secs, int usecs=0)"
.br
.RI "\fISets the timeout value for the connection (if this is not passiveSocket) or acception (if it is). \fP"
.ti -1c
.RI "timeval \fBtimeout\fP () const "
.br
.RI "\fIReturns the timeout value for the connection. \fP"
.ti -1c
.RI "bool \fBsetBlockingMode\fP (bool enable)"
.br
.RI "\fISets/unsets blocking mode for the socket. \fP"
.ti -1c
.RI "bool \fBblockingMode\fP ()"
.br
.RI "\fIReturns the current blocking mode for this socket. \fP"
.ti -1c
.RI "bool \fBsetAddressReusable\fP (bool enable)"
.br
.RI "\fISets/unsets address reusing flag for this socket. \fP"
.ti -1c
.RI "bool \fBaddressReusable\fP ()"
.br
.RI "\fIReturns whether this socket's address can be reused. \fP"
.ti -1c
.RI "bool \fBsetIPv6Only\fP (bool enable)"
.br
.RI "\fISets/unsets the v6-only flag for IPv6 sockets. \fP"
.ti -1c
.RI "bool \fBisIPv6Only\fP ()"
.br
.RI "\fIReturns the status of the v6-only flag for IPv6 sockets. \fP"
.ti -1c
.RI "virtual bool \fBsetBufferSize\fP (int rsize, int wsize=-2)"
.br
.RI "\fISets the buffer sizes for this socket. \fP"
.ti -1c
.RI "const  \fBKSocketAddress\fP * \fBlocalAddress\fP ()"
.br
.RI "\fIReturns the local socket address. \fP"
.ti -1c
.RI "const  \fBKSocketAddress\fP * \fBpeerAddress\fP ()"
.br
.RI "\fIReturns the peer socket address. \fP"
.ti -1c
.RI "int \fBfd\fP () const "
.br
.RI "\fIReturns the file descriptor. \fP"
.ti -1c
.RI "virtual int \fBlookup\fP ()"
.br
.RI "\fIPerforms lookup on the addresses we were given before. \fP"
.ti -1c
.RI "virtual int \fBstartAsyncLookup\fP ()"
.br
.RI "\fIStarts an asynchronous lookup for the addresses given. \fP"
.ti -1c
.RI "virtual void \fBcancelAsyncLookup\fP ()"
.br
.RI "\fICancels any on-going asynchronous lookups. \fP"
.ti -1c
.RI "virtual int \fBlisten\fP (int N=5)"
.br
.RI "\fIPlace the socket in listen mode. \fP"
.ti -1c
.RI "virtual int \fBaccept\fP (\fBKExtendedSocket\fP *&sock)"
.br
.RI "\fIAccepts an incoming connection from the socket. \fP"
.ti -1c
.RI "virtual int \fBconnect\fP ()"
.br
.RI "\fIAttempts to connect to the remote host. \fP"
.ti -1c
.RI "virtual int \fBstartAsyncConnect\fP ()"
.br
.RI "\fIStarts an asynchronous connect. \fP"
.ti -1c
.RI "virtual void \fBcancelAsyncConnect\fP ()"
.br
.RI "\fICancels any on-going asynchronous connection attempt. \fP"
.ti -1c
.RI "virtual bool \fBopen\fP (int \fBmode\fP=IO_Raw|IO_ReadWrite)"
.br
.RI "\fIImplementation of \fBQIODevice::open\fP() pure virtual function. \fP"
.ti -1c
.RI "virtual void \fBclose\fP ()"
.br
.RI "\fICloses the socket. \fP"
.ti -1c
.RI "virtual void \fBcloseNow\fP ()"
.br
.RI "\fICloses the socket now, discarding the contents of the write buffer, if any. \fP"
.ti -1c
.RI "virtual void \fBrelease\fP ()"
.br
.RI "\fIReleases the socket and anything we have holding on it. \fP"
.ti -1c
.RI "virtual void \fBflush\fP ()"
.br
.RI "\fIFlushes the socket buffer. \fP"
.ti -1c
.RI "virtual Q_ULONG \fBsize\fP () const "
.br
.RI "\fIReturns length of this socket. \fP"
.ti -1c
.RI "virtual Q_ULONG \fBat\fP () const "
.br
.RI "\fIReturns relative position from start. \fP"
.ti -1c
.RI "virtual bool \fBat\fP (int i)"
.br
.RI "\fIReturns true if we are at position. \fP"
.ti -1c
.RI "virtual bool \fBatEnd\fP () const "
.br
.RI "\fIReturns true if we are at the end. \fP"
.ti -1c
.RI "virtual Q_LONG \fBreadBlock\fP (char *data, Q_ULONG maxlen)"
.br
.RI "\fIReads a block of data from the socket. \fP"
.ti -1c
.RI "virtual Q_LONG \fBwriteBlock\fP (const  char *data, Q_ULONG len)"
.br
.RI "\fIWrites a block of data to the socket. \fP"
.ti -1c
.RI "virtual int \fBpeekBlock\fP (char *data, uint maxlen)"
.br
.RI "\fIPeeks at a block of data from the socket. \fP"
.ti -1c
.RI "virtual int \fBunreadBlock\fP (const  char *data, uint len)"
.br
.RI "\fIReimplementation of \fBunreadBlock()\fP method. \fP"
.ti -1c
.RI "virtual int \fBbytesAvailable\fP () const "
.br
.RI "\fIReturns the number of available bytes yet to be read via \fBreadBlock\fP and family of functions. \fP"
.ti -1c
.RI "virtual int \fBwaitForMore\fP (int msec)"
.br
.RI "\fIWaits \fCmsec\fP milliseconds for more data to be available (use 0 to wait forever). \fP"
.ti -1c
.RI "virtual int \fBgetch\fP ()"
.br
.RI "\fIGets a single character (unsigned char) from the stream. \fP"
.ti -1c
.RI "virtual int \fBputch\fP (int ch)"
.br
.RI "\fIWrites a single character (unsigned char) to the stream. \fP"
.ti -1c
.RI "virtual int \fBungetch\fP (int)"
.br
.RI "\fIUnreads one character from the stream. \fP"
.ti -1c
.RI "virtual void \fBenableRead\fP (bool enable)"
.br
.RI "\fIToggles the emission of the readyRead signal. \fP"
.ti -1c
.RI "virtual void \fBenableWrite\fP (bool enable)"
.br
.RI "\fIToggles the emission of the readyWrite signal. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "int \fBresolve\fP (sockaddr *sock, ksocklen_t len, \fBQString\fP &host, \fBQString\fP &port, int \fBflags\fP=0)"
.br
.RI "\fIPerforms resolution on the given socket address. \fP"
.ti -1c
.RI "int \fBresolve\fP (\fBKSocketAddress\fP *sock, \fBQString\fP &host, \fBQString\fP &port, int \fBflags\fP=0)"
.br
.RI "\fIPerforms resolution on the given socket address. \fP"
.ti -1c
.RI "\fBQPtrList\fP< \fBKAddressInfo\fP > \fBlookup\fP (const  \fBQString\fP &host, const  \fBQString\fP &port, int \fBflags\fP=0, int *error=0)"
.br
.RI "\fIPerforms lookup on the given hostname/port combination and returns a list of matching addresses. \fP"
.ti -1c
.RI "\fBKSocketAddress\fP * \fBlocalAddress\fP (int fd)"
.br
.RI "\fIReturns the local socket address Remember to delete the returned object when it is no longer needed. \fP"
.ti -1c
.RI "\fBKSocketAddress\fP * \fBpeerAddress\fP (int fd)"
.br
.RI "\fIReturns the peer socket address. \fP"
.ti -1c
.RI "\fBQString\fP \fBstrError\fP (int code, int syserr)"
.br
.RI "\fIReturns the representing text of this error code. \fP"
.ti -1c
.RI "bool \fBsetAddressReusable\fP (int fd, bool enable)"
.br
.RI "\fISets/unsets address reusing flag for this socket. \fP"
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "void \fBsocketActivityRead\fP ()"
.br
.ti -1c
.RI "void \fBsocketActivityWrite\fP ()"
.br
.ti -1c
.RI "void \fBdnsResultsReady\fP ()"
.br
.ti -1c
.RI "void \fBstartAsyncConnectSlot\fP ()"
.br
.ti -1c
.RI "void \fBconnectionEvent\fP ()"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "\fBQSocketNotifier\fP * \fBreadNotifier\fP ()"
.br
.ti -1c
.RI "\fBQSocketNotifier\fP * \fBwriteNotifier\fP ()"
.br
.ti -1c
.RI "void \fBsetError\fP (int errorkind, int error)"
.br
.RI "\fISets the error code. \fP"
.ti -1c
.RI "void \fBcleanError\fP ()"
.br
.ti -1c
.RI "void \fBsetSocketStatus\fP (int \fBstatus\fP)"
.br
.RI "\fISets the socket status. \fP"
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "int \fBsockfd\fP"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKSocket\fP"
.br
.ti -1c
.RI "class \fBKServerSocket\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
The extended socket class. an extended socket. 

This class should be used instead of \fBKSocket\fP whenever the user needs fine-grained control over the socket being created. Unlike \fBKSocket\fP, which does everything at once, without much intervention, KExtendedSocket allows intervention at every step of the process and the setting of parameters.
.PP
This class allows for the creation of both server and client sockets. The only difference is that the passiveSocket flag must be passed either to the constructor or to \fBsetSocketFlags\fP(). If passiveSocket is used, the class will enable functions \fBlisten\fP() and \fBaccept\fP() and related signals, and will also disable \fBreadBlock\fP() and \fBwriteBlock\fP().
.PP
To create a Unix socket, one would pass flag unixSocket to the constructor or \fBsetSocketFlags\fP(). The hostname and service/port can be set to whatever is necessary. If no hostname is given, but a service/port is, the socket created will be implementation dependant (usually in /tmp). In any other case, the fields will be concatenated.
.PP
To create an Internet socket, inetSocket flag can be used. If, on the other hand a specific IP protocol is desired, ipv4Socket and/or ipv6Socket can be used.
.PP
Note that the socket type selection flags are cumulative. One could select Unix and Internet sockets by using unixSocket | inetSocket. Or, for instance, to make sure only IPv4 and IPv6 sockets are selected, even if future implementations support newer IP protocols, ipv4Socket | ipv6Socket is your guy.
.PP
\fBAuthor:\fP
.RS 4
Thiago Macieira <thiagom@mail.com> 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBkextsock.h\fP,v 1.30.2.2 2003/05/29 18:12:23 thiago Exp 
.RE
.PP
.RE
.PP

.PP
Definition at line 83 of file kextsock.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBKExtendedSocket::Flags\fP"
.PP
flags that can be passed down to the member functions Definition at line 91 of file kextsock.h.
.SS "enum \fBKExtendedSocket::SockStatus\fP"
.PP
status of the class The status are sequential. If a change to one status is requested, all the prior status will be passed and their actions, performed Definition at line 123 of file kextsock.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KExtendedSocket::KExtendedSocket ()"
.PP
Creates an empty KExtendedSocket. Definition at line 407 of file kextsock.cpp.
.SS "KExtendedSocket::KExtendedSocket (const \fBQString\fP & host, int port, int flags = 0)"
.PP
Creates a socket with the given hostname and port. \fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.br
\fIport\fP the port number 
.br
\fIflags\fP flags 
.RE
.PP
Definition at line 413 of file kextsock.cpp.
.PP
References QIODevice::flags(), setAddress(), and setSocketFlags().
.SS "KExtendedSocket::KExtendedSocket (const \fBQString\fP & host, const \fBQString\fP & service, int flags = 0)"
.PP
Creates a socket with the given hostname and service. \fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.br
\fIserv\fP the service 
.br
\fIflags\fP flags 
.RE
.PP
Definition at line 421 of file kextsock.cpp.
.PP
References QIODevice::flags(), setAddress(), and setSocketFlags().
.SS "KExtendedSocket::~\fBKExtendedSocket\fP ()\fC [virtual]\fP"
.PP
Destroys the socket, disconnecting if still connected and freeing any related resources still being kept. Definition at line 429 of file kextsock.cpp.
.PP
References closeNow().
.SH "Member Function Documentation"
.PP 
.SS "void KExtendedSocket::reset ()"
.PP
Resets the socket, disconnecting if still connected and freeing any related resources still being kept. \fBSince:\fP
.RS 4
3.1 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 449 of file kextsock.cpp.
.PP
References closeNow(), and release().
.SS "int KExtendedSocket::socketStatus () const"
.PP
Returns the class status. \fBReturns:\fP
.RS 4
the class status 
.RE
.PP
\fBSee also:\fP
.RS 4
::SockStatus 
.RE
.PP
Definition at line 458 of file kextsock.cpp.
.SS "int KExtendedSocket::systemError () const"
.PP
Returns the related system error code Except for IO_LookupError errors, these are codes found in errno. \fBReturns:\fP
.RS 4
the system error code 
.RE
.PP
Definition at line 474 of file kextsock.cpp.
.SS "int KExtendedSocket::setSocketFlags (int flags)"
.PP
Sets the given flags. \fBParameters:\fP
.RS 4
\fIflags\fP the flags to be set 
.RE
.PP
\fBReturns:\fP
.RS 4
the new flags status, or -1 if flags can no longer be set 
.RE
.PP
Definition at line 483 of file kextsock.cpp.
.PP
Referenced by KExtendedSocket().
.SS "int KExtendedSocket::socketFlags () const"
.PP
Returns the current flags. \fBReturns:\fP
.RS 4
the current flags 
.RE
.PP
\fBSee also:\fP
.RS 4
::Flags 
.RE
.PP
Definition at line 491 of file kextsock.cpp.
.SS "bool KExtendedSocket::setHost (const \fBQString\fP & host)"
.PP
Sets the hostname to the given value. \fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.RE
.PP
\fBReturns:\fP
.RS 4
true on success, false on error 
.RE
.PP
Definition at line 500 of file kextsock.cpp.
.PP
Referenced by setAddress().
.SS "\fBQString\fP KExtendedSocket::host () const"
.PP
Returns the hostname. \fBReturns:\fP
.RS 4
the hostname or QString::null if no host has been set 
.RE
.PP
Definition at line 512 of file kextsock.cpp.
.SS "bool KExtendedSocket::setPort (int port)"
.PP
Sets the port/service. \fBParameters:\fP
.RS 4
\fIport\fP the port 
.RE
.PP
Definition at line 521 of file kextsock.cpp.
.PP
References QString::number().
.PP
Referenced by setAddress().
.SS "bool KExtendedSocket::setPort (const \fBQString\fP & service)"
.PP
Sets the port/service. \fBParameters:\fP
.RS 4
\fIport\fP the port 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 526 of file kextsock.cpp.
.SS "\fBQString\fP KExtendedSocket::port () const"
.PP
Returns the port/service. If it is a port, the string contains a number. 
.PP
\fBReturns:\fP
.RS 4
the port or QString::null if it has not been set. 
.RE
.PP
Definition at line 538 of file kextsock.cpp.
.SS "bool KExtendedSocket::setAddress (const \fBQString\fP & host, int port)"
.PP
Sets the address where we will connect to. \fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.br
\fIport\fP port number 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 546 of file kextsock.cpp.
.PP
References setHost(), and setPort().
.PP
Referenced by KExtendedSocket().
.SS "bool KExtendedSocket::setAddress (const \fBQString\fP & host, const \fBQString\fP & serv)"
.PP
Sets the address where we will connect to. \fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.br
\fIserv\fP the service 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 554 of file kextsock.cpp.
.PP
References setHost(), and setPort().
.SS "bool KExtendedSocket::setBindHost (const \fBQString\fP & host)"
.PP
Sets the hostname to which we will bind locally before connecting. \fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.RE
.PP
\fBReturns:\fP
.RS 4
false if this is a passiveSocket, otherwise true. 
.RE
.PP
Definition at line 564 of file kextsock.cpp.
.PP
Referenced by setBindAddress().
.SS "bool KExtendedSocket::unsetBindHost ()"
.PP
Unsets the bind hostname. That is, don't request a binding host. 
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 577 of file kextsock.cpp.
.PP
Referenced by unsetBindAddress().
.SS "\fBQString\fP KExtendedSocket::bindHost () const"
.PP
Returns the hostname to which the socket will be/is bound. \fBReturns:\fP
.RS 4
the host or QString::null if it has not been set. 
.RE
.PP
Definition at line 589 of file kextsock.cpp.
.SS "bool KExtendedSocket::setBindPort (int port)"
.PP
Sets the port/service to which we will bind before connecting. \fBParameters:\fP
.RS 4
\fIport\fP the port number 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 598 of file kextsock.cpp.
.PP
References QString::number().
.PP
Referenced by setBindAddress().
.SS "bool KExtendedSocket::setBindPort (const \fBQString\fP & service)"
.PP
Sets the port/service to which we will bind before connecting. \fBParameters:\fP
.RS 4
\fIservice\fP the port number or service name 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 603 of file kextsock.cpp.
.SS "bool KExtendedSocket::unsetBindPort ()"
.PP
Unsets the bind port/service. \fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 615 of file kextsock.cpp.
.PP
Referenced by unsetBindAddress().
.SS "\fBQString\fP KExtendedSocket::bindPort () const"
.PP
Returns the service to which the socket will be/is bound. \fBReturns:\fP
.RS 4
the host or QString::null if it has not been set. 
.RE
.PP
Definition at line 627 of file kextsock.cpp.
.SS "bool KExtendedSocket::setBindAddress (const \fBQString\fP & host, int port)"
.PP
Sets both host and port to which we will bind the socket. Will return false if this is a passiveSocket. 
.PP
\fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.br
\fIport\fP the port number 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 635 of file kextsock.cpp.
.PP
References setBindHost(), and setBindPort().
.SS "bool KExtendedSocket::setBindAddress (const \fBQString\fP & host, const \fBQString\fP & service)"
.PP
Sets both host and service to which we will bind the socket. Will return false if this is a passiveSocket. 
.PP
\fBParameters:\fP
.RS 4
\fIhost\fP the hostname 
.br
\fIserv\fP the service 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 643 of file kextsock.cpp.
.PP
References setBindHost(), and setBindPort().
.SS "bool KExtendedSocket::unsetBindAddress ()"
.PP
Unsets the bind address for the socket. That means that we won't attempt to bind to an address before connecting. 
.PP
\fBReturns:\fP
.RS 4
true if successful, false on error (e.g. connection already established) 
.RE
.PP
Definition at line 651 of file kextsock.cpp.
.PP
References unsetBindHost(), and unsetBindPort().
.SS "bool KExtendedSocket::setTimeout (int secs, int usecs = 0)"
.PP
Sets the timeout value for the connection (if this is not passiveSocket) or acception (if it is). In the event the given function (connect or accept) returns due to time out, it's possible to call it again.
.PP
Setting the timeout to 0 disables the timeout feature.
.PP
\fBParameters:\fP
.RS 4
\fIsecs\fP the timeout length, in seconds 
.br
\fIusecs\fP the timeout complement, in microseconds 
.RE
.PP
\fBReturns:\fP
.RS 4
false if setting timeout makes no sense in the context. 
.RE
.PP
Definition at line 659 of file kextsock.cpp.
.SS "timeval KExtendedSocket::timeout () const"
.PP
Returns the timeout value for the connection. \fBReturns:\fP
.RS 4
the timeout value. 0 if there is no timeout. 
.RE
.PP
Definition at line 672 of file kextsock.cpp.
.SS "bool KExtendedSocket::setBlockingMode (bool enable)"
.PP
Sets/unsets blocking mode for the socket. When non-blocking mode is enabled, I/O operations might return error and set errno to EWOULDBLOCK. Also, it's not recommended to use this when using the class signals.
.PP
\fBParameters:\fP
.RS 4
\fIenable\fP if true, set blocking mode. False, non-blocking mode. 
.RE
.PP
\fBReturns:\fP
.RS 4
false on error. 
.RE
.PP
Definition at line 680 of file kextsock.cpp.
.PP
References setError().
.PP
Referenced by accept(), and connect().
.SS "bool KExtendedSocket::blockingMode ()"
.PP
Returns the current blocking mode for this socket. \fBReturns:\fP
.RS 4
true if in blocking mode 
.RE
.PP
Definition at line 709 of file kextsock.cpp.
.PP
References setError().
.PP
Referenced by accept().
.SS "bool KExtendedSocket::setAddressReusable (bool enable)"
.PP
Sets/unsets address reusing flag for this socket. This function returns true if the value was set correctly. That is NOT the result of the set. 
.PP
\fBParameters:\fP
.RS 4
\fIenable\fP if true, set address reusable 
.RE
.PP
\fBReturns:\fP
.RS 4
true on success, false on failure. If the socket was not yet created, the value is only remembered. In this case the return value is always true. 
.RE
.PP
Definition at line 730 of file kextsock.cpp.
.PP
References setError().
.PP
Referenced by connect(), and listen().
.SS "bool KExtendedSocket::addressReusable ()"
.PP
Returns whether this socket's address can be reused. \fBReturns:\fP
.RS 4
true if the address can be reused 
.RE
.PP
Definition at line 763 of file kextsock.cpp.
.PP
References setError().
.SS "bool KExtendedSocket::setIPv6Only (bool enable)"
.PP
Sets/unsets the v6-only flag for IPv6 sockets. When an IPv6 socket is in use, communication with IPv4 sockets is guaranteed by translating those IPv4 addresses into IPv6 ones (specifically, the v4-mapped addresses). This flag allows that behaviour to be turned on and off.
.PP
Note that this does not have any effect on sockets that are not IPv6 and the function will always return false in those cases. Also note that this flag defaults to off in order to accomodate existing applications.
.PP
\fBParameters:\fP
.RS 4
\fIenable\fP if true, no IPv4 translation will be performed; this socket will be restricted to IPv6 communication 
.RE
.PP
\fBReturns:\fP
.RS 4
true on success, false on failure. 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBlocalAddress\fP to find out if this is an IPv6 socket 
.RE
.PP
Definition at line 786 of file kextsock.cpp.
.PP
References setError().
.PP
Referenced by connect(), and listen().
.SS "bool KExtendedSocket::isIPv6Only ()"
.PP
Returns the status of the v6-only flag for IPv6 sockets. \fBReturns:\fP
.RS 4
true if the flag is set to on; false if it is not. If this socket is not an IPv6 one, the return value is false. 
.RE
.PP
\fBSee also:\fP
.RS 4
\fBsetIPv6Only\fP 
.RE
.PP
Definition at line 818 of file kextsock.cpp.
.PP
References setError().
.SS "bool KExtendedSocket::setBufferSize (int rsize, int wsize = -2)\fC [virtual]\fP"
.PP
Sets the buffer sizes for this socket. This implementation allows any size for both parameters. The value given will be interpreted as the maximum size allowed for the buffers, after which the I/O functions will stop buffering. The value of -1 will be interpreted as 'unlimited' size. The value of -2 means 'no change'.
.PP
Note: changing the buffer size to 0 for any buffer will cause the given buffer's to be discarded. Likewise, setting the size to a value less than the current size will cause the buffer to be shrunk to the wanted value, as if the data had been read.
.PP
Note 2: The \fBclosed()\fP signal will only be emitted for a connection closed by the remote end if we are doing input buffering. That happens because if we aren't reading from the connection, we don't know when it closed. 
.PP
\fBParameters:\fP
.RS 4
\fIrsize\fP read buffer size 
.br
\fIwsize\fP write buffer size 
.RE
.PP
\fBReturns:\fP
.RS 4
true on success, false if this is not possible in this state (e.g. connection not established yet) 
.RE
.PP
Reimplemented from \fBKBufferedIO\fP.
.PP
Definition at line 848 of file kextsock.cpp.
.PP
References QObject::connect(), KBufferedIO::consumeReadBuffer(), KBufferedIO::consumeWriteBuffer(), QIODevice::mode(), KBufferedIO::readBufferSize(), and KBufferedIO::writeBufferSize().
.PP
Referenced by accept(), and connect().
.SS "const  \fBKSocketAddress\fP * KExtendedSocket::localAddress ()"
.PP
Returns the local socket address. \fBReturns:\fP
.RS 4
the local socket address, can be 0 if the connection has not been established yet 
.RE
.PP
Definition at line 950 of file kextsock.cpp.
.SS "const  \fBKSocketAddress\fP * KExtendedSocket::peerAddress ()"
.PP
Returns the peer socket address. Use \fBKExtendedSocket::resolve()\fP to resolve this to a human-readable hostname/service or port. 
.PP
\fBReturns:\fP
.RS 4
the peer address, can be 0 if the connection has not been established yet or the socket is passive 
.RE
.PP
Definition at line 965 of file kextsock.cpp.
.SS "int KExtendedSocket::fd () const\fC [inline]\fP"
.PP
Returns the file descriptor. \fBReturns:\fP
.RS 4
the file descriptor. -1 if there is no fd yet. 
.RE
.PP
Definition at line 456 of file kextsock.h.
.PP
Referenced by KServerSocket::slotAccept().
.SS "int KExtendedSocket::lookup ()\fC [virtual]\fP"
.PP
Performs lookup on the addresses we were given before. This will perform lookups on the bind addresses if they were given. 
.PP
\fBReturns:\fP
.RS 4
0 or an error. Do not rely on the values returned by lookup as of now. They are not specified. 
.RE
.PP
Definition at line 978 of file kextsock.cpp.
.PP
References setError().
.PP
Referenced by connect(), and listen().
.SS "int KExtendedSocket::startAsyncLookup ()\fC [virtual]\fP"
.PP
Starts an asynchronous lookup for the addresses given. When the lookup is done, the lookupReady signal will be emitted.
.PP
Note that, depending on the parameters for the lookup, this function might know the results without the need for blocking or queueing an asynchronous lookup. That means that the lookupReady signal might be emitted by this function, so your code should be prepared for that.
.PP
One such case is when noResolve flag is set. If this function is able to determine the results without queueing and the lookup failed, this function will return -1.
.PP
\fBReturns:\fP
.RS 4
0 on success or -1 on error. Note that returning 0 means that either we are in the process of doing lookup or that it has finished already. 
.RE
.PP
Definition at line 1024 of file kextsock.cpp.
.PP
References QObject::connect(), lookupFinished(), and setError().
.PP
Referenced by startAsyncConnect().
.SS "void KExtendedSocket::cancelAsyncLookup ()\fC [virtual]\fP"
.PP
Cancels any on-going asynchronous lookups. Definition at line 1097 of file kextsock.cpp.
.PP
Referenced by closeNow().
.SS "int KExtendedSocket::listen (int N = 5)\fC [virtual]\fP"
.PP
Place the socket in listen mode. The parameters are the same as for the system \fBlisten()\fP call. 
.PP
\fBParameters:\fP
.RS 4
\fIN\fP the queue length for pending connections 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on system error (errno available) and -2 if this is not a passiveSocket. 
.RE
.PP
Definition at line 1120 of file kextsock.cpp.
.PP
References KSocks::bind(), QObject::connect(), KSocks::listen(), lookup(), KSocks::self(), setAddressReusable(), setError(), and setIPv6Only().
.PP
Referenced by accept(), and open().
.SS "int KExtendedSocket::accept (\fBKExtendedSocket\fP *& sock)\fC [virtual]\fP"
.PP
Accepts an incoming connection from the socket. If this socket is in blocking mode, this function will block until a connection is received. Otherwise, it might return with error. The sock parameter will be initialised with the newly created socket.
.PP
Upon successful acception (i.e., this function returns 0), the newly created socket will be already connected. The socket will be unbuffered and \fBreadyRead()\fP and \fBreadyWrite()\fP signals will be disabled.
.PP
\fBParameters:\fP
.RS 4
\fIsock\fP a pointer to an KExtendedSocket variable 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on system error (errno set) and -2 if this is not a passiveSocket and -3 if this took too long (time out) 
.RE
.PP
Definition at line 1189 of file kextsock.cpp.
.PP
References KSocks::accept(), blockingMode(), d, listen(), KSocks::select(), KSocks::self(), setBlockingMode(), setBufferSize(), setError(), and sockfd.
.SS "int KExtendedSocket::connect ()\fC [virtual]\fP"
.PP
Attempts to connect to the remote host. After successful connection (return value 0), the socket will be ready for I/O operations. Note, however, that not all signals may be enabled for emission by this socket: 
.IP "\(bu" 2
\fBreadyRead\fP and \fBreadyWrite\fP signals will be enabled only if \fBenableRead\fP or \fBenableWrite\fP were called. You can still enable them by calling those functions, of course. 
.IP "\(bu" 2
\fBclosed()\fP will only be sent if we are indeed reading from the input stream. That is, if this socket is buffering the input. See \fBsetBufferSize\fP
.PP
Note that, in general, functions inherited/overriden from \fBKBufferedIO\fP will only work on buffered sockets, like bytesAvailable and bytesToWrite. 
.PP
\fBReturns:\fP
.RS 4
The return values are: 
.IP "\(bu" 2
0: success 
.IP "\(bu" 2
-1: system error, errno was set accordingly 
.IP "\(bu" 2
-2: this socket cannot \fBconnect()\fP; this is a passiveSocket. It can also mean that the function was unable to make a connection with the given bind address or that an asynchronous connection attempt is already in progress. 
.IP "\(bu" 2
-3: connection timed out 
.PP
.RE
.PP
Definition at line 1261 of file kextsock.cpp.
.PP
References KSocks::bind(), KSocks::connect(), connectionFailed(), connectionSuccess(), KStdAccel::end(), KSocks::hasWorkingAsyncConnect(), lookup(), KSocks::select(), KSocks::self(), setAddressReusable(), setBlockingMode(), setBufferSize(), setError(), and setIPv6Only().
.PP
Referenced by open().
.SS "int KExtendedSocket::startAsyncConnect ()\fC [virtual]\fP"
.PP
Starts an asynchronous connect. This works exactly the same as \fBconnect\fP, except that the connection result won't be returned.
.PP
Note that those signals might be emitted before this function returns, so your code should be prepared for that condition. 
.PP
\fBReturns:\fP
.RS 4
0 on successful queueing of the connect or -1 on error. If this function returns 0, then the \fBconnectionSuccess\fP() or the \fBconnectionFailed\fP() signals will be emitted. 
.RE
.PP
Definition at line 1477 of file kextsock.cpp.
.PP
References QObject::connect(), lookupFinished(), and startAsyncLookup().
.SS "void KExtendedSocket::cancelAsyncConnect ()\fC [virtual]\fP"
.PP
Cancels any on-going asynchronous connection attempt. Definition at line 1512 of file kextsock.cpp.
.PP
Referenced by closeNow().
.SS "bool KExtendedSocket::open (int mode = IO_Raw|IO_ReadWrite)\fC [virtual]\fP"
.PP
Implementation of \fBQIODevice::open\fP() pure virtual function. This depends on the target host address already being there. If this is a passiveSocket, this is identical to call \fBlisten()\fP; else, if this is not a passiveSocket and no connection attempt is in progress, this is like \fBconnect()\fP. If one is in progress, this function will fail. 
.PP
\fBParameters:\fP
.RS 4
\fImode\fP the open mode. Must be IO_Raw | IO_ReadWrite 
.RE
.PP
\fBReturns:\fP
.RS 4
true if successful, false when an error occurred or the most was not correct 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1532 of file kextsock.cpp.
.PP
References connect(), and listen().
.SS "void KExtendedSocket::close ()\fC [virtual]\fP"
.PP
Closes the socket. If we have data still in the write buffer yet to be sent, the socket won't be closed right now. It'll be closed after we managed to send everything out. If you want to close the socket now, you may want to call \fBflush\fP() first, and then \fBcloseNow\fP(). Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1545 of file kextsock.cpp.
.PP
References KBufferedIO::closed(), KBufferedIO::readBufferSize(), and KBufferedIO::writeBufferSize().
.SS "void KExtendedSocket::closeNow ()\fC [virtual]\fP"
.PP
Closes the socket now, discarding the contents of the write buffer, if any. The read buffer's contents are kept until they are emptied by read operations or the class is destroyed. Implements \fBKBufferedIO\fP.
.PP
Definition at line 1579 of file kextsock.cpp.
.PP
References cancelAsyncConnect(), cancelAsyncLookup(), KBufferedIO::closed(), KBufferedIO::readBufferSize(), and KBufferedIO::writeBufferSize().
.PP
Referenced by reset(), and ~KExtendedSocket().
.SS "void KExtendedSocket::release ()\fC [virtual]\fP"
.PP
Releases the socket and anything we have holding on it. The class cannot be used anymore. In other words, this is just like \fBcloseNow()\fP, but it does not actually close the socket.
.PP
This is useful if you just want to connect and don't need the rest of the class.
.PP
Note that the buffers' contents will be discarded.
.PP
Use of this method is discouraged, because the socket created might be such that normal library routines can't handle (read, write, close, etc.) Definition at line 1606 of file kextsock.cpp.
.PP
References KBufferedIO::consumeReadBuffer(), KBufferedIO::consumeWriteBuffer(), KBufferedIO::readBufferSize(), and KBufferedIO::writeBufferSize().
.PP
Referenced by reset(), and KServerSocket::slotAccept().
.SS "void KExtendedSocket::flush ()\fC [virtual]\fP"
.PP
Flushes the socket buffer. You need not call this method during normal operation as we will try and send everything as soon as possible. However, if you want to make sure that data in the buffer is being sent at this moment, you can call this function. It will try to send as much data as possible, but it will stop as soon as the kernel cannot receive any more data, and would possibly block.
.PP
By repeatedly calling this function, the behaviour will be like that of a blocking socket. Indeed, if this function is called with the kernel not ready to receive data, it will block, unless this is a non-blocking socket.
.PP
This function does not touch the read buffer. You can empty it by calling \fBreadBlock\fP() with a null destination buffer. Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1640 of file kextsock.cpp.
.PP
References KBufferedIO::bytesWritten(), KBufferedIO::consumeWriteBuffer(), QPtrList< QByteArray >::first(), QPtrList< QByteArray >::next(), KBufferedIO::outBuf, KSocks::self(), setError(), KSocks::write(), and KBufferedIO::writeBufferSize().
.SS "virtual Q_ULONG KExtendedSocket::size () const\fC [inline, virtual]\fP"
.PP
Returns length of this socket. This call is not supported on sockets. 
.PP
\fBReturns:\fP
.RS 4
the length of this socket, or 0 if unsupported 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 632 of file kextsock.h.
.SS "virtual Q_ULONG KExtendedSocket::at () const\fC [inline, virtual]\fP"
.PP
Returns relative position from start. This call is not supported on sockets. 
.PP
\fBReturns:\fP
.RS 4
the relative position from the start, or 0 if unsupported 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 639 of file kextsock.h.
.SS "virtual bool KExtendedSocket::at (int i)\fC [inline, virtual]\fP"
.PP
Returns true if we are at position. This is not supported on sockets. 
.PP
\fBParameters:\fP
.RS 4
\fIi\fP the position to check 
.RE
.PP
\fBReturns:\fP
.RS 4
true if we art at the given position, or always true if unsupported. 
.RE
.PP
Definition at line 647 of file kextsock.h.
.SS "virtual bool KExtendedSocket::atEnd () const\fC [inline, virtual]\fP"
.PP
Returns true if we are at the end. This is not supported on sockets, but we always are at the end in a socket... 
.PP
\fBReturns:\fP
.RS 4
true if we are at the end. Always false if unsupported. 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 655 of file kextsock.h.
.SS "Q_LONG KExtendedSocket::readBlock (char * data, Q_ULONG maxlen)\fC [virtual]\fP"
.PP
Reads a block of data from the socket. If the socket is not buffered, this function will simply call the underlying read method. This function will block if the socket is not on non-blocking mode (see \fBsetBlockingMode\fP) and there is not enough data to be read in the Operating System yet. If we are in non-blocking operation, the call will fail in this case.
.PP
However, if we are buffering, this function will instead read from the buffer while there is available data. This function will never block in buffering mode, which means that if you try to read while the buffers are empty, this function will always return -1 and set the system error to EWOULDBLOCK (aka EAGAIN), so as to mimic non-blocking operation.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP where we will write the read data to 
.br
\fImaxlen\fP maximum length of data to be read 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes effectively read, or a negative number in case or an error. If the \fCdata\fP param is not null, then this is also the number of bytes copied into that buffer. If the return value is different than \fCmaxlen\fP, then this function encountered a situation in which no more bytes were available. Subsequent calls might cause this function to one of these behaviours: 
.IP "\(bu" 2
return an error, with EWOULDBLOCK system error, if we buffering or we are in non-blocking mode 
.IP "\(bu" 2
otherwise, it'll block This function returns 0, if the function detected end-of-file condition (socket was closed) 
.PP
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1699 of file kextsock.cpp.
.PP
References KBufferedIO::consumeReadBuffer(), KSocks::read(), KSocks::self(), and setError().
.PP
Referenced by getch().
.SS "Q_LONG KExtendedSocket::writeBlock (const char * data, Q_ULONG len)\fC [virtual]\fP"
.PP
Writes a block of data to the socket. If the socket is not buffered, this function will simply call the underlying write method. This means that the function might block if that method blocks as well. That situation is possible if we are not in non-blocking mode and the operating system buffers are full for this socket. If we are in non-blocking mode and the operating system buffers are full, this function will return -1 and the system error will be set to EWOULDBLOCK.
.PP
If we are buffering, this function will simply transfer the data into the write buffer. This function will then always succeed, as long as there is enough room in the buffer. If the buffer size was limited and that limit is reached, this function will copy no more bytes than that limit. Trying to write with a full buffer will return -1 and set system error to EWOULDBLOCK.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP the data to write 
.br
\fIlen\fP the length of data to write 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes written from \fCdata\fP buffer. The return value might be less than \fClen\fP if the output buffers cannot accommodate that many bytes and -1 in the case of an errro. 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1744 of file kextsock.cpp.
.PP
References KBufferedIO::bytesWritten(), KBufferedIO::feedWriteBuffer(), KSocks::self(), setError(), KSocks::write(), and KBufferedIO::writeBufferSize().
.PP
Referenced by putch().
.SS "int KExtendedSocket::peekBlock (char * data, uint maxlen)\fC [virtual]\fP"
.PP
Peeks at a block of data from the socket. This is exactly like read, except that the data won't be flushed from the read buffer.
.PP
If this socket is not buffered, this function will always return with 0 bytes copied.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP where to store the data 
.br
\fImaxlen\fP how many bytes to copy, at most 
.RE
.PP
\fBReturns:\fP
.RS 4
the number of bytes copied. 0 does not mean end-of-file condition. 
.RE
.PP
Implements \fBKBufferedIO\fP.
.PP
Definition at line 1798 of file kextsock.cpp.
.PP
References KBufferedIO::consumeReadBuffer().
.SS "int KExtendedSocket::unreadBlock (const char * data, uint len)\fC [virtual]\fP"
.PP
Reimplementation of \fBunreadBlock()\fP method. This is so because unreading in sockets doesn't make sense, so this function will always return -1 (error) and set the system error to ENOSYS. 
.PP
\fBReturns:\fP
.RS 4
always -1 (error) 
.RE
.PP
Reimplemented from \fBKBufferedIO\fP.
.PP
Definition at line 1813 of file kextsock.cpp.
.PP
References setError().
.SS "int KExtendedSocket::bytesAvailable () const\fC [virtual]\fP"
.PP
Returns the number of available bytes yet to be read via \fBreadBlock\fP and family of functions. Note: as of now, this only works on input-buffered sockets. This will change in the future 
.PP
\fBReturns:\fP
.RS 4
The number of available bytes, or -1 on error or -2 if this call is invalid in the current state. 
.RE
.PP
Reimplemented from \fBKBufferedIO\fP.
.PP
Definition at line 1820 of file kextsock.cpp.
.PP
References KBufferedIO::bytesAvailable().
.PP
Referenced by waitForMore().
.SS "int KExtendedSocket::waitForMore (int msec)\fC [virtual]\fP"
.PP
Waits \fCmsec\fP milliseconds for more data to be available (use 0 to wait forever). The return value is the amount of data available for read in the read buffer.
.PP
\fBParameters:\fP
.RS 4
\fImsec\fP milliseconds to wait 
.RE
.PP
\fBReturns:\fP
.RS 4
-1 in case of system error and -2 in case of invalid socket state 
.RE
.PP
Implements \fBKBufferedIO\fP.
.PP
Definition at line 1833 of file kextsock.cpp.
.PP
References bytesAvailable(), KSocks::select(), KSocks::self(), and setError().
.SS "int KExtendedSocket::getch ()\fC [virtual]\fP"
.PP
Gets a single character (unsigned char) from the stream. \fBReturns:\fP
.RS 4
the value of the character. Negative if there was an error. 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1860 of file kextsock.cpp.
.PP
References readBlock().
.SS "int KExtendedSocket::putch (int ch)\fC [virtual]\fP"
.PP
Writes a single character (unsigned char) to the stream. All other bits will be ignored. 
.PP
\fBParameters:\fP
.RS 4
\fIch\fP character to write, converted to char 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 1871 of file kextsock.cpp.
.PP
References writeBlock().
.SS "virtual int KExtendedSocket::ungetch (int)\fC [inline, virtual]\fP"
.PP
Unreads one character from the stream. This is not possible on sockets. 
.PP
\fBReturns:\fP
.RS 4
always returns -1 on sockets. 
.RE
.PP
Reimplemented from \fBQIODevice\fP.
.PP
Definition at line 777 of file kextsock.h.
.SS "void KExtendedSocket::enableRead (bool enable)\fC [virtual]\fP"
.PP
Toggles the emission of the readyRead signal. Note that this signal is emitted every time more data is available to be read, so you might get flooded with it being emitted every time, when in non-buffered mode. However, in buffered mode, this signal will be emitted only when there is data coming in from the wire. By default, this flag is set to false, i.e., signal not being emitted. 
.PP
\fBParameters:\fP
.RS 4
\fIenable\fP if true, the signal will be emitted 
.RE
.PP
Implements \fBKAsyncIO\fP.
.PP
Definition at line 1911 of file kextsock.cpp.
.SS "void KExtendedSocket::enableWrite (bool enable)\fC [virtual]\fP"
.PP
Toggles the emission of the readyWrite signal. Note that this signal is emitted only when the OS is ready to receive more data, which means that the write buffer is empty. And when that is reached, this signal will possibly be emitted on every loop, so you might want to disable it. By default, this flag is set to false. 
.PP
\fBParameters:\fP
.RS 4
\fIenable\fP if true, the signal will be emitted 
.RE
.PP
Implements \fBKAsyncIO\fP.
.PP
Definition at line 1926 of file kextsock.cpp.
.SS "void KExtendedSocket::lookupFinished (int count)\fC [signal]\fP"
.PP
This signal is emitted whenever an asynchronous lookup process is done. The parameter \fCcount\fP tells 
.PP
\fBParameters:\fP
.RS 4
\fIcount\fP the number of results 
.RE
.PP
Referenced by startAsyncConnect(), and startAsyncLookup().
.SS "void KExtendedSocket::connectionSuccess ()\fC [signal]\fP"
.PP
This signal is emitted whenever we connected asynchronously to a host. Referenced by connect().
.SS "void KExtendedSocket::connectionFailed (int error)\fC [signal]\fP"
.PP
This signal is emitted whenever our asynchronous connection attempt failed to all hosts listed. \fBParameters:\fP
.RS 4
\fIerror\fP the errno code of the last connection attempt 
.RE
.PP
Referenced by connect().
.SS "void KExtendedSocket::readyAccept ()\fC [signal]\fP"
.PP
This signal is emitted whenever this socket is ready to accept another socket. \fBSee also:\fP
.RS 4
\fBaccept()\fP 
.RE
.PP

.SS "void KExtendedSocket::setError (int errorkind, int error)\fC [protected]\fP"
.PP
Sets the error code. Definition at line 468 of file kextsock.cpp.
.PP
Referenced by accept(), addressReusable(), blockingMode(), connect(), flush(), isIPv6Only(), listen(), lookup(), readBlock(), setAddressReusable(), setBlockingMode(), setIPv6Only(), startAsyncLookup(), unreadBlock(), waitForMore(), and writeBlock().
.SS "void KExtendedSocket::setSocketStatus (int status)\fC [protected]\fP"
.PP
Sets the socket status. For derived classes only. Definition at line 463 of file kextsock.cpp.
.SS "int KExtendedSocket::resolve (sockaddr * sock, ksocklen_t len, \fBQString\fP & host, \fBQString\fP & port, int flags = 0)\fC [static]\fP"
.PP
Performs resolution on the given socket address. That is, tries to resolve the raw form of the socket address into a textual representation.
.PP
\fBParameters:\fP
.RS 4
\fIsockaddr\fP the socket address 
.br
\fIhost\fP where the hostname will be written 
.br
\fIport\fP where the service-port will be written 
.br
\fIflags\fP the same flags as getnameinfo() 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, nonzero otherwise. 
.RE
.PP
Definition at line 2258 of file kextsock.cpp.
.PP
References QString::fromUtf8().
.PP
Referenced by resolve().
.SS "int KExtendedSocket::resolve (\fBKSocketAddress\fP * sock, \fBQString\fP & host, \fBQString\fP & port, int flags = 0)\fC [static]\fP"
.PP
Performs resolution on the given socket address. That is, tries to resolve the raw form of the socket address into a textual representation.
.PP
\fBParameters:\fP
.RS 4
\fIsockaddr\fP the socket address 
.br
\fIhost\fP where the hostname will be written 
.br
\fIport\fP where the service-port will be written 
.br
\fIflags\fP the same flags as getnameinfo() 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, nonzero otherwise. 
.RE
.PP
Definition at line 2273 of file kextsock.cpp.
.PP
References KSocketAddress::data, KSocketAddress::datasize, and resolve().
.SS "\fBQPtrList\fP< \fBKAddressInfo\fP > KExtendedSocket::lookup (const \fBQString\fP & host, const \fBQString\fP & port, int flags = 0, int * error = 0)\fC [static]\fP"
.PP
Performs lookup on the given hostname/port combination and returns a list of matching addresses. The error code can be transformed into string by \fBKExtendedSocket::strError\fP() with code of IO_LookupError.
.PP
IMPORTANT: the result values of the \fBQPtrList\fP must be deleted after use. So, if you don't copy the \fBKAddressInfo\fP objects, the best way to assure that is to call setAutoDelete(true) on the list right after this function returns. If you do copy the results out, you must assure that the objects get deleted when they are not needed any more.
.PP
\fBParameters:\fP
.RS 4
\fIhost\fP the hostname to look up 
.br
\fIport\fP the port/service to look up 
.br
\fIflags\fP flags to be used when looking up, \fBFlags\fP 
.br
\fIerror\fP pointer to a variable holding the error code 
.RE
.PP
\fBReturns:\fP
.RS 4
a list of \fBKAddressInfos\fP 
.RE
.PP
Definition at line 2279 of file kextsock.cpp.
.PP
References QPtrList::append().
.SS "\fBKSocketAddress\fP * KExtendedSocket::localAddress (int fd)\fC [static]\fP"
.PP
Returns the local socket address Remember to delete the returned object when it is no longer needed. \fBParameters:\fP
.RS 4
\fIfd\fP the file descriptor 
.RE
.PP
\fBReturns:\fP
.RS 4
the local socket address or 0 if an error occurred. Delete after use. 
.RE
.PP
Definition at line 2320 of file kextsock.cpp.
.PP
References KSocks::getsockname(), KSocketAddress::newAddress(), and KSocks::self().
.SS "\fBKSocketAddress\fP * KExtendedSocket::peerAddress (int fd)\fC [static]\fP"
.PP
Returns the peer socket address. Use \fBKExtendedSocket::resolve()\fP to resolve this to a human-readable hostname/service or port. Remember to delete the returned object when it is no longer needed. 
.PP
\fBParameters:\fP
.RS 4
\fIfd\fP the file descriptor 
.RE
.PP
\fBReturns:\fP
.RS 4
the peer socket address or 0 if an error occurred. Delete after use. 
.RE
.PP
Definition at line 2368 of file kextsock.cpp.
.PP
References KSocks::getpeername(), KSocketAddress::newAddress(), and KSocks::self().
.SS "\fBQString\fP KExtendedSocket::strError (int code, int syserr)\fC [static]\fP"
.PP
Returns the representing text of this error code. \fBParameters:\fP
.RS 4
\fIcode\fP the error code, as seen in \fBstatus()\fP 
.br
\fIsyserr\fP the system error, as from \fBsystemError()\fP 
.RE
.PP
\fBReturns:\fP
.RS 4
the text for the given error code 
.RE
.PP
Definition at line 2414 of file kextsock.cpp.
.PP
References QString::fromLocal8Bit().
.SS "bool KExtendedSocket::setAddressReusable (int fd, bool enable)\fC [static]\fP"
.PP
Sets/unsets address reusing flag for this socket. This function returns true if the value was set correctly. That is NOT the result of the set. 
.PP
\fBParameters:\fP
.RS 4
\fIfd\fP the file descriptor 
.br
\fIenable\fP if true, set address reusable 
.RE
.PP
\fBReturns:\fP
.RS 4
true on success, false on failure. 
.RE
.PP
Definition at line 748 of file kextsock.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for kdecore Library from the source code.
