\section{KExtended\-Socket Class Reference}
\label{classKExtendedSocket}\index{KExtendedSocket@{KExtendedSocket}}
The extended socket class. an extended socket.  


{\tt \#include $<$kextsock.h$>$}

Inheritance diagram for KExtended\-Socket:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=84pt]{classKExtendedSocket__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KExtended\-Socket:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=162pt]{classKExtendedSocket__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Flags} \{ \par
{\bf any\-Socket} =  0x00, 
{\bf known\-Socket} =  0x01, 
{\bf unix\-Socket} =  known\-Socket $|$ 0x02, 
{\bf inet\-Socket} =  known\-Socket $|$ 0x04, 
\par
{\bf ipv4Socket} =  inet\-Socket $|$ 0x100, 
{\bf ipv6Socket} =  inet\-Socket $|$ 0x200, 
{\bf passive\-Socket} =  0x1000, 
{\bf canon\-Name} =  0x2000, 
\par
{\bf no\-Resolve} =  0x4000, 
{\bf stream\-Socket} =  0x8000, 
{\bf datagram\-Socket} =  0x10000, 
{\bf raw\-Socket} =  0x20000, 
\par
{\bf input\-Buffered\-Socket} =  0x200000, 
{\bf output\-Buffered\-Socket} =  0x400000, 
{\bf buffered\-Socket} =  0x600000
 \}
\begin{CompactList}\small\item\em flags that can be passed down to the member functions \item\end{CompactList}\item 
enum {\bf Sock\-Status} \{ \par
{\bf error} =  -1, 
{\bf nothing} =  0, 
{\bf lookup\-In\-Progress} =  50, 
{\bf lookup\-Done} =  70, 
\par
{\bf created} =  100, 
{\bf bound} =  140, 
{\bf connecting} =  200, 
{\bf connected} =  220, 
\par
{\bf listening} =  200, 
{\bf accepting} =  220, 
{\bf closing} =  350, 
{\bf done} =  400
 \}
\begin{CompactList}\small\item\em status of the class The status are sequential. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf lookup\-Finished} (int count)
\begin{CompactList}\small\item\em This signal is emitted whenever an asynchronous lookup process is done. \item\end{CompactList}\item 
void {\bf connection\-Success} ()
\begin{CompactList}\small\item\em This signal is emitted whenever we connected asynchronously to a host. \item\end{CompactList}\item 
void {\bf connection\-Failed} (int error)
\begin{CompactList}\small\item\em This signal is emitted whenever our asynchronous connection attempt failed to all hosts listed. \item\end{CompactList}\item 
void {\bf ready\-Accept} ()
\begin{CompactList}\small\item\em This signal is emitted whenever this socket is ready to accept another socket. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KExtended\-Socket} ()
\begin{CompactList}\small\item\em Creates an empty KExtended\-Socket. \item\end{CompactList}\item 
{\bf KExtended\-Socket} (const  {\bf QString} \&host, int port, int {\bf flags}=0)
\begin{CompactList}\small\item\em Creates a socket with the given hostname and port. \item\end{CompactList}\item 
{\bf KExtended\-Socket} (const  {\bf QString} \&host, const  {\bf QString} \&service, int {\bf flags}=0)
\begin{CompactList}\small\item\em Creates a socket with the given hostname and service. \item\end{CompactList}\item 
virtual {\bf $\sim$KExtended\-Socket} ()
\begin{CompactList}\small\item\em Destroys the socket, disconnecting if still connected and freeing any related resources still being kept. \item\end{CompactList}\item 
void {\bf reset} ()
\begin{CompactList}\small\item\em Resets the socket, disconnecting if still connected and freeing any related resources still being kept. \item\end{CompactList}\item 
int {\bf socket\-Status} () const 
\begin{CompactList}\small\item\em Returns the class status. \item\end{CompactList}\item 
int {\bf system\-Error} () const 
\begin{CompactList}\small\item\em Returns the related system error code Except for IO\_\-Lookup\-Error errors, these are codes found in errno. \item\end{CompactList}\item 
int {\bf set\-Socket\-Flags} (int {\bf flags})
\begin{CompactList}\small\item\em Sets the given flags. \item\end{CompactList}\item 
int {\bf socket\-Flags} () const 
\begin{CompactList}\small\item\em Returns the current flags. \item\end{CompactList}\item 
bool {\bf set\-Host} (const  {\bf QString} \&host)
\begin{CompactList}\small\item\em Sets the hostname to the given value. \item\end{CompactList}\item 
{\bf QString} {\bf host} () const 
\begin{CompactList}\small\item\em Returns the hostname. \item\end{CompactList}\item 
bool {\bf set\-Port} (int port)
\begin{CompactList}\small\item\em Sets the port/service. \item\end{CompactList}\item 
bool {\bf set\-Port} (const  {\bf QString} \&service)
\begin{CompactList}\small\item\em Sets the port/service. \item\end{CompactList}\item 
{\bf QString} {\bf port} () const 
\begin{CompactList}\small\item\em Returns the port/service. \item\end{CompactList}\item 
bool {\bf set\-Address} (const  {\bf QString} \&host, int port)
\begin{CompactList}\small\item\em Sets the address where we will connect to. \item\end{CompactList}\item 
bool {\bf set\-Address} (const  {\bf QString} \&host, const  {\bf QString} \&serv)
\begin{CompactList}\small\item\em Sets the address where we will connect to. \item\end{CompactList}\item 
bool {\bf set\-Bind\-Host} (const  {\bf QString} \&host)
\begin{CompactList}\small\item\em Sets the hostname to which we will bind locally before connecting. \item\end{CompactList}\item 
bool {\bf unset\-Bind\-Host} ()
\begin{CompactList}\small\item\em Unsets the bind hostname. \item\end{CompactList}\item 
{\bf QString} {\bf bind\-Host} () const 
\begin{CompactList}\small\item\em Returns the hostname to which the socket will be/is bound. \item\end{CompactList}\item 
bool {\bf set\-Bind\-Port} (int port)
\begin{CompactList}\small\item\em Sets the port/service to which we will bind before connecting. \item\end{CompactList}\item 
bool {\bf set\-Bind\-Port} (const  {\bf QString} \&service)
\begin{CompactList}\small\item\em Sets the port/service to which we will bind before connecting. \item\end{CompactList}\item 
bool {\bf unset\-Bind\-Port} ()
\begin{CompactList}\small\item\em Unsets the bind port/service. \item\end{CompactList}\item 
{\bf QString} {\bf bind\-Port} () const 
\begin{CompactList}\small\item\em Returns the service to which the socket will be/is bound. \item\end{CompactList}\item 
bool {\bf set\-Bind\-Address} (const  {\bf QString} \&host, int port)
\begin{CompactList}\small\item\em Sets both host and port to which we will bind the socket. \item\end{CompactList}\item 
bool {\bf set\-Bind\-Address} (const  {\bf QString} \&host, const  {\bf QString} \&service)
\begin{CompactList}\small\item\em Sets both host and service to which we will bind the socket. \item\end{CompactList}\item 
bool {\bf unset\-Bind\-Address} ()
\begin{CompactList}\small\item\em Unsets the bind address for the socket. \item\end{CompactList}\item 
bool {\bf set\-Timeout} (int secs, int usecs=0)
\begin{CompactList}\small\item\em Sets the timeout value for the connection (if this is not passive\-Socket) or acception (if it is). \item\end{CompactList}\item 
timeval {\bf timeout} () const 
\begin{CompactList}\small\item\em Returns the timeout value for the connection. \item\end{CompactList}\item 
bool {\bf set\-Blocking\-Mode} (bool enable)
\begin{CompactList}\small\item\em Sets/unsets blocking mode for the socket. \item\end{CompactList}\item 
bool {\bf blocking\-Mode} ()
\begin{CompactList}\small\item\em Returns the current blocking mode for this socket. \item\end{CompactList}\item 
bool {\bf set\-Address\-Reusable} (bool enable)
\begin{CompactList}\small\item\em Sets/unsets address reusing flag for this socket. \item\end{CompactList}\item 
bool {\bf address\-Reusable} ()
\begin{CompactList}\small\item\em Returns whether this socket's address can be reused. \item\end{CompactList}\item 
bool {\bf set\-IPv6Only} (bool enable)
\begin{CompactList}\small\item\em Sets/unsets the v6-only flag for IPv6 sockets. \item\end{CompactList}\item 
bool {\bf is\-IPv6Only} ()
\begin{CompactList}\small\item\em Returns the status of the v6-only flag for IPv6 sockets. \item\end{CompactList}\item 
virtual bool {\bf set\-Buffer\-Size} (int rsize, int wsize=-2)
\begin{CompactList}\small\item\em Sets the buffer sizes for this socket. \item\end{CompactList}\item 
const  {\bf KSocket\-Address} $\ast$ {\bf local\-Address} ()
\begin{CompactList}\small\item\em Returns the local socket address. \item\end{CompactList}\item 
const  {\bf KSocket\-Address} $\ast$ {\bf peer\-Address} ()
\begin{CompactList}\small\item\em Returns the peer socket address. \item\end{CompactList}\item 
int {\bf fd} () const 
\begin{CompactList}\small\item\em Returns the file descriptor. \item\end{CompactList}\item 
virtual int {\bf lookup} ()
\begin{CompactList}\small\item\em Performs lookup on the addresses we were given before. \item\end{CompactList}\item 
virtual int {\bf start\-Async\-Lookup} ()
\begin{CompactList}\small\item\em Starts an asynchronous lookup for the addresses given. \item\end{CompactList}\item 
virtual void {\bf cancel\-Async\-Lookup} ()
\begin{CompactList}\small\item\em Cancels any on-going asynchronous lookups. \item\end{CompactList}\item 
virtual int {\bf listen} (int N=5)
\begin{CompactList}\small\item\em Place the socket in listen mode. \item\end{CompactList}\item 
virtual int {\bf accept} ({\bf KExtended\-Socket} $\ast$\&sock)
\begin{CompactList}\small\item\em Accepts an incoming connection from the socket. \item\end{CompactList}\item 
virtual int {\bf connect} ()
\begin{CompactList}\small\item\em Attempts to connect to the remote host. \item\end{CompactList}\item 
virtual int {\bf start\-Async\-Connect} ()
\begin{CompactList}\small\item\em Starts an asynchronous connect. \item\end{CompactList}\item 
virtual void {\bf cancel\-Async\-Connect} ()
\begin{CompactList}\small\item\em Cancels any on-going asynchronous connection attempt. \item\end{CompactList}\item 
virtual bool {\bf open} (int {\bf mode}=IO\_\-Raw$|$IO\_\-Read\-Write)
\begin{CompactList}\small\item\em Implementation of {\bf QIODevice::open}() pure virtual function. \item\end{CompactList}\item 
virtual void {\bf close} ()
\begin{CompactList}\small\item\em Closes the socket. \item\end{CompactList}\item 
virtual void {\bf close\-Now} ()
\begin{CompactList}\small\item\em Closes the socket now, discarding the contents of the write buffer, if any. \item\end{CompactList}\item 
virtual void {\bf release} ()
\begin{CompactList}\small\item\em Releases the socket and anything we have holding on it. \item\end{CompactList}\item 
virtual void {\bf flush} ()
\begin{CompactList}\small\item\em Flushes the socket buffer. \item\end{CompactList}\item 
virtual Q\_\-ULONG {\bf size} () const 
\begin{CompactList}\small\item\em Returns length of this socket. \item\end{CompactList}\item 
virtual Q\_\-ULONG {\bf at} () const 
\begin{CompactList}\small\item\em Returns relative position from start. \item\end{CompactList}\item 
virtual bool {\bf at} (int i)
\begin{CompactList}\small\item\em Returns true if we are at position. \item\end{CompactList}\item 
virtual bool {\bf at\-End} () const 
\begin{CompactList}\small\item\em Returns true if we are at the end. \item\end{CompactList}\item 
virtual Q\_\-LONG {\bf read\-Block} (char $\ast$data, Q\_\-ULONG maxlen)
\begin{CompactList}\small\item\em Reads a block of data from the socket. \item\end{CompactList}\item 
virtual Q\_\-LONG {\bf write\-Block} (const  char $\ast$data, Q\_\-ULONG len)
\begin{CompactList}\small\item\em Writes a block of data to the socket. \item\end{CompactList}\item 
virtual int {\bf peek\-Block} (char $\ast$data, uint maxlen)
\begin{CompactList}\small\item\em Peeks at a block of data from the socket. \item\end{CompactList}\item 
virtual int {\bf unread\-Block} (const  char $\ast$data, uint len)
\begin{CompactList}\small\item\em Reimplementation of {\bf unread\-Block()}{\rm (p.\,\pageref{classKExtendedSocket_a58})} method. \item\end{CompactList}\item 
virtual int {\bf bytes\-Available} () const 
\begin{CompactList}\small\item\em Returns the number of available bytes yet to be read via {\bf read\-Block}{\rm (p.\,\pageref{classKExtendedSocket_a55})} and family of functions. \item\end{CompactList}\item 
virtual int {\bf wait\-For\-More} (int msec)
\begin{CompactList}\small\item\em Waits {\tt msec} milliseconds for more data to be available (use 0 to wait forever). \item\end{CompactList}\item 
virtual int {\bf getch} ()
\begin{CompactList}\small\item\em Gets a single character (unsigned char) from the stream. \item\end{CompactList}\item 
virtual int {\bf putch} (int ch)
\begin{CompactList}\small\item\em Writes a single character (unsigned char) to the stream. \item\end{CompactList}\item 
virtual int {\bf ungetch} (int)
\begin{CompactList}\small\item\em Unreads one character from the stream. \item\end{CompactList}\item 
virtual void {\bf enable\-Read} (bool enable)
\begin{CompactList}\small\item\em Toggles the emission of the ready\-Read signal. \item\end{CompactList}\item 
virtual void {\bf enable\-Write} (bool enable)
\begin{CompactList}\small\item\em Toggles the emission of the ready\-Write signal. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
int {\bf resolve} (sockaddr $\ast$sock, ksocklen\_\-t len, {\bf QString} \&host, {\bf QString} \&port, int {\bf flags}=0)
\begin{CompactList}\small\item\em Performs resolution on the given socket address. \item\end{CompactList}\item 
int {\bf resolve} ({\bf KSocket\-Address} $\ast$sock, {\bf QString} \&host, {\bf QString} \&port, int {\bf flags}=0)
\begin{CompactList}\small\item\em Performs resolution on the given socket address. \item\end{CompactList}\item 
{\bf QPtr\-List}$<$ {\bf KAddress\-Info} $>$ {\bf lookup} (const  {\bf QString} \&host, const  {\bf QString} \&port, int {\bf flags}=0, int $\ast$error=0)
\begin{CompactList}\small\item\em Performs lookup on the given hostname/port combination and returns a list of matching addresses. \item\end{CompactList}\item 
{\bf KSocket\-Address} $\ast$ {\bf local\-Address} (int fd)
\begin{CompactList}\small\item\em Returns the local socket address Remember to delete the returned object when it is no longer needed. \item\end{CompactList}\item 
{\bf KSocket\-Address} $\ast$ {\bf peer\-Address} (int fd)
\begin{CompactList}\small\item\em Returns the peer socket address. \item\end{CompactList}\item 
{\bf QString} {\bf str\-Error} (int code, int syserr)
\begin{CompactList}\small\item\em Returns the representing text of this error code. \item\end{CompactList}\item 
bool {\bf set\-Address\-Reusable} (int fd, bool enable)
\begin{CompactList}\small\item\em Sets/unsets address reusing flag for this socket. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf socket\-Activity\-Read} ()\label{classKExtendedSocket_j0}

\item 
void {\bf socket\-Activity\-Write} ()\label{classKExtendedSocket_j1}

\item 
void {\bf dns\-Results\-Ready} ()\label{classKExtendedSocket_j2}

\item 
void {\bf start\-Async\-Connect\-Slot} ()\label{classKExtendedSocket_j3}

\item 
void {\bf connection\-Event} ()\label{classKExtendedSocket_j4}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf QSocket\-Notifier} $\ast$ {\bf read\-Notifier} ()\label{classKExtendedSocket_b0}

\item 
{\bf QSocket\-Notifier} $\ast$ {\bf write\-Notifier} ()\label{classKExtendedSocket_b1}

\item 
void {\bf set\-Error} (int errorkind, int error)
\begin{CompactList}\small\item\em Sets the error code. \item\end{CompactList}\item 
void {\bf clean\-Error} ()\label{classKExtendedSocket_b3}

\item 
void {\bf set\-Socket\-Status} (int {\bf status})
\begin{CompactList}\small\item\em Sets the socket status. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKExtendedSocket_b5}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
int {\bf sockfd}\label{classKExtendedSocket_p0}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KSocket}\label{classKExtendedSocket_n0}

\item 
class {\bf KServer\-Socket}\label{classKExtendedSocket_n1}

\end{CompactItemize}


\subsection{Detailed Description}
The extended socket class. an extended socket. 

This class should be used instead of {\bf KSocket}{\rm (p.\,\pageref{classKSocket})} whenever the user needs fine-grained control over the socket being created. Unlike {\bf KSocket}{\rm (p.\,\pageref{classKSocket})}, which does everything at once, without much intervention, KExtended\-Socket allows intervention at every step of the process and the setting of parameters.

This class allows for the creation of both server and client sockets. The only difference is that the passive\-Socket flag must be passed either to the constructor or to {\bf set\-Socket\-Flags}{\rm (p.\,\pageref{classKExtendedSocket_a7})}(). If passive\-Socket is used, the class will enable functions {\bf listen}{\rm (p.\,\pageref{classKExtendedSocket_a41})}() and {\bf accept}{\rm (p.\,\pageref{classKExtendedSocket_a42})}() and related signals, and will also disable {\bf read\-Block}{\rm (p.\,\pageref{classKExtendedSocket_a55})}() and {\bf write\-Block}{\rm (p.\,\pageref{classKExtendedSocket_a56})}().

To create a Unix socket, one would pass flag unix\-Socket to the constructor or {\bf set\-Socket\-Flags}{\rm (p.\,\pageref{classKExtendedSocket_a7})}(). 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.

To create an Internet socket, inet\-Socket flag can be used. If, on the other hand a specific IP protocol is desired, ipv4Socket and/or ipv6Socket can be used.

Note that the socket type selection flags are cumulative. One could select Unix and Internet sockets by using unix\-Socket $|$ inet\-Socket. 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.

\begin{Desc}
\item[Author:]Thiago Macieira $<${\tt thiagom@mail.com}$>$ \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf kextsock.h}{\rm (p.\,\pageref{kextsock_8h})},v 1.30.2.2 2003/05/29 18:12:23 thiago Exp \end{Desc}
\end{Desc}




Definition at line 83 of file kextsock.h.

\subsection{Member Enumeration Documentation}
\index{KExtendedSocket@{KExtended\-Socket}!Flags@{Flags}}
\index{Flags@{Flags}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KExtended\-Socket::Flags}}\label{classKExtendedSocket_w27}


flags that can be passed down to the member functions 



Definition at line 91 of file kextsock.h.\index{KExtendedSocket@{KExtended\-Socket}!SockStatus@{SockStatus}}
\index{SockStatus@{SockStatus}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KExtended\-Socket::Sock\-Status}}\label{classKExtendedSocket_w28}


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.

\subsection{Constructor \& Destructor Documentation}
\index{KExtendedSocket@{KExtended\-Socket}!KExtendedSocket@{KExtendedSocket}}
\index{KExtendedSocket@{KExtendedSocket}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KExtended\-Socket::KExtended\-Socket ()}\label{classKExtendedSocket_a0}


Creates an empty KExtended\-Socket. 



Definition at line 407 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!KExtendedSocket@{KExtendedSocket}}
\index{KExtendedSocket@{KExtendedSocket}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KExtended\-Socket::KExtended\-Socket (const {\bf QString} \& {\em host}, int {\em port}, int {\em flags} = 0)}\label{classKExtendedSocket_a1}


Creates a socket with the given hostname and port. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \item[{\em port}]the port number \item[{\em flags}]flags \end{description}
\end{Desc}


Definition at line 413 of file kextsock.cpp.

References QIODevice::flags(), set\-Address(), and set\-Socket\-Flags().\index{KExtendedSocket@{KExtended\-Socket}!KExtendedSocket@{KExtendedSocket}}
\index{KExtendedSocket@{KExtendedSocket}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KExtended\-Socket::KExtended\-Socket (const {\bf QString} \& {\em host}, const {\bf QString} \& {\em service}, int {\em flags} = 0)}\label{classKExtendedSocket_a2}


Creates a socket with the given hostname and service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \item[{\em serv}]the service \item[{\em flags}]flags \end{description}
\end{Desc}


Definition at line 421 of file kextsock.cpp.

References QIODevice::flags(), set\-Address(), and set\-Socket\-Flags().\index{KExtendedSocket@{KExtended\-Socket}!~KExtendedSocket@{$\sim$KExtendedSocket}}
\index{~KExtendedSocket@{$\sim$KExtendedSocket}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KExtended\-Socket::$\sim${\bf KExtended\-Socket} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a3}


Destroys the socket, disconnecting if still connected and freeing any related resources still being kept. 



Definition at line 429 of file kextsock.cpp.

References close\-Now().

\subsection{Member Function Documentation}
\index{KExtendedSocket@{KExtended\-Socket}!reset@{reset}}
\index{reset@{reset}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::reset ()}\label{classKExtendedSocket_a4}


Resets the socket, disconnecting if still connected and freeing any related resources still being kept. 

\begin{Desc}
\item[Since:]3.1 \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 449 of file kextsock.cpp.

References close\-Now(), and release().\index{KExtendedSocket@{KExtended\-Socket}!socketStatus@{socketStatus}}
\index{socketStatus@{socketStatus}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::socket\-Status () const}\label{classKExtendedSocket_a5}


Returns the class status. 

\begin{Desc}
\item[Returns:]the class status \end{Desc}
\begin{Desc}
\item[See also:]::Sock\-Status \end{Desc}


Definition at line 458 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!systemError@{systemError}}
\index{systemError@{systemError}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::system\-Error () const}\label{classKExtendedSocket_a6}


Returns the related system error code Except for IO\_\-Lookup\-Error errors, these are codes found in errno. 

\begin{Desc}
\item[Returns:]the system error code \end{Desc}


Definition at line 474 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setSocketFlags@{setSocketFlags}}
\index{setSocketFlags@{setSocketFlags}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::set\-Socket\-Flags (int {\em flags})}\label{classKExtendedSocket_a7}


Sets the given flags. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em flags}]the flags to be set \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the new flags status, or -1 if flags can no longer be set \end{Desc}


Definition at line 483 of file kextsock.cpp.

Referenced by KExtended\-Socket().\index{KExtendedSocket@{KExtended\-Socket}!socketFlags@{socketFlags}}
\index{socketFlags@{socketFlags}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::socket\-Flags () const}\label{classKExtendedSocket_a8}


Returns the current flags. 

\begin{Desc}
\item[Returns:]the current flags \end{Desc}
\begin{Desc}
\item[See also:]::Flags \end{Desc}


Definition at line 491 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setHost@{setHost}}
\index{setHost@{setHost}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Host (const {\bf QString} \& {\em host})}\label{classKExtendedSocket_a9}


Sets the hostname to the given value. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success, false on error \end{Desc}


Definition at line 500 of file kextsock.cpp.

Referenced by set\-Address().\index{KExtendedSocket@{KExtended\-Socket}!host@{host}}
\index{host@{host}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KExtended\-Socket::host () const}\label{classKExtendedSocket_a10}


Returns the hostname. 

\begin{Desc}
\item[Returns:]the hostname or QString::null if no host has been set \end{Desc}


Definition at line 512 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setPort@{setPort}}
\index{setPort@{setPort}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Port (int {\em port})}\label{classKExtendedSocket_a11}


Sets the port/service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em port}]the port \end{description}
\end{Desc}


Definition at line 521 of file kextsock.cpp.

References QString::number().

Referenced by set\-Address().\index{KExtendedSocket@{KExtended\-Socket}!setPort@{setPort}}
\index{setPort@{setPort}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Port (const {\bf QString} \& {\em service})}\label{classKExtendedSocket_a12}


Sets the port/service. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em port}]the port \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 526 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!port@{port}}
\index{port@{port}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KExtended\-Socket::port () const}\label{classKExtendedSocket_a13}


Returns the port/service. 

If it is a port, the string contains a number. \begin{Desc}
\item[Returns:]the port or QString::null if it has not been set. \end{Desc}


Definition at line 538 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setAddress@{setAddress}}
\index{setAddress@{setAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Address (const {\bf QString} \& {\em host}, int {\em port})}\label{classKExtendedSocket_a14}


Sets the address where we will connect to. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \item[{\em port}]port number \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 546 of file kextsock.cpp.

References set\-Host(), and set\-Port().

Referenced by KExtended\-Socket().\index{KExtendedSocket@{KExtended\-Socket}!setAddress@{setAddress}}
\index{setAddress@{setAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Address (const {\bf QString} \& {\em host}, const {\bf QString} \& {\em serv})}\label{classKExtendedSocket_a15}


Sets the address where we will connect to. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \item[{\em serv}]the service \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 554 of file kextsock.cpp.

References set\-Host(), and set\-Port().\index{KExtendedSocket@{KExtended\-Socket}!setBindHost@{setBindHost}}
\index{setBindHost@{setBindHost}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Bind\-Host (const {\bf QString} \& {\em host})}\label{classKExtendedSocket_a16}


Sets the hostname to which we will bind locally before connecting. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false if this is a passive\-Socket, otherwise true. \end{Desc}


Definition at line 564 of file kextsock.cpp.

Referenced by set\-Bind\-Address().\index{KExtendedSocket@{KExtended\-Socket}!unsetBindHost@{unsetBindHost}}
\index{unsetBindHost@{unsetBindHost}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::unset\-Bind\-Host ()}\label{classKExtendedSocket_a17}


Unsets the bind hostname. 

That is, don't request a binding host. \begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 577 of file kextsock.cpp.

Referenced by unset\-Bind\-Address().\index{KExtendedSocket@{KExtended\-Socket}!bindHost@{bindHost}}
\index{bindHost@{bindHost}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KExtended\-Socket::bind\-Host () const}\label{classKExtendedSocket_a18}


Returns the hostname to which the socket will be/is bound. 

\begin{Desc}
\item[Returns:]the host or QString::null if it has not been set. \end{Desc}


Definition at line 589 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setBindPort@{setBindPort}}
\index{setBindPort@{setBindPort}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Bind\-Port (int {\em port})}\label{classKExtendedSocket_a19}


Sets the port/service to which we will bind before connecting. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em port}]the port number \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 598 of file kextsock.cpp.

References QString::number().

Referenced by set\-Bind\-Address().\index{KExtendedSocket@{KExtended\-Socket}!setBindPort@{setBindPort}}
\index{setBindPort@{setBindPort}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Bind\-Port (const {\bf QString} \& {\em service})}\label{classKExtendedSocket_a20}


Sets the port/service to which we will bind before connecting. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em service}]the port number or service name \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 603 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!unsetBindPort@{unsetBindPort}}
\index{unsetBindPort@{unsetBindPort}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::unset\-Bind\-Port ()}\label{classKExtendedSocket_a21}


Unsets the bind port/service. 

\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 615 of file kextsock.cpp.

Referenced by unset\-Bind\-Address().\index{KExtendedSocket@{KExtended\-Socket}!bindPort@{bindPort}}
\index{bindPort@{bindPort}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KExtended\-Socket::bind\-Port () const}\label{classKExtendedSocket_a22}


Returns the service to which the socket will be/is bound. 

\begin{Desc}
\item[Returns:]the host or QString::null if it has not been set. \end{Desc}


Definition at line 627 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setBindAddress@{setBindAddress}}
\index{setBindAddress@{setBindAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Bind\-Address (const {\bf QString} \& {\em host}, int {\em port})}\label{classKExtendedSocket_a23}


Sets both host and port to which we will bind the socket. 

Will return false if this is a passive\-Socket. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \item[{\em port}]the port number \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 635 of file kextsock.cpp.

References set\-Bind\-Host(), and set\-Bind\-Port().\index{KExtendedSocket@{KExtended\-Socket}!setBindAddress@{setBindAddress}}
\index{setBindAddress@{setBindAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Bind\-Address (const {\bf QString} \& {\em host}, const {\bf QString} \& {\em service})}\label{classKExtendedSocket_a24}


Sets both host and service to which we will bind the socket. 

Will return false if this is a passive\-Socket. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname \item[{\em serv}]the service \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 643 of file kextsock.cpp.

References set\-Bind\-Host(), and set\-Bind\-Port().\index{KExtendedSocket@{KExtended\-Socket}!unsetBindAddress@{unsetBindAddress}}
\index{unsetBindAddress@{unsetBindAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::unset\-Bind\-Address ()}\label{classKExtendedSocket_a25}


Unsets the bind address for the socket. 

That means that we won't attempt to bind to an address before connecting. \begin{Desc}
\item[Returns:]true if successful, false on error (e.g. connection already established) \end{Desc}


Definition at line 651 of file kextsock.cpp.

References unset\-Bind\-Host(), and unset\-Bind\-Port().\index{KExtendedSocket@{KExtended\-Socket}!setTimeout@{setTimeout}}
\index{setTimeout@{setTimeout}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Timeout (int {\em secs}, int {\em usecs} = 0)}\label{classKExtendedSocket_a26}


Sets the timeout value for the connection (if this is not passive\-Socket) 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.

Setting the timeout to 0 disables the timeout feature.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em secs}]the timeout length, in seconds \item[{\em usecs}]the timeout complement, in microseconds \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false if setting timeout makes no sense in the context. \end{Desc}


Definition at line 659 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!timeout@{timeout}}
\index{timeout@{timeout}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}timeval KExtended\-Socket::timeout () const}\label{classKExtendedSocket_a27}


Returns the timeout value for the connection. 

\begin{Desc}
\item[Returns:]the timeout value. 0 if there is no timeout. \end{Desc}


Definition at line 672 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!setBlockingMode@{setBlockingMode}}
\index{setBlockingMode@{setBlockingMode}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Blocking\-Mode (bool {\em enable})}\label{classKExtendedSocket_a28}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]if true, set blocking mode. False, non-blocking mode. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false on error. \end{Desc}


Definition at line 680 of file kextsock.cpp.

References set\-Error().

Referenced by accept(), and connect().\index{KExtendedSocket@{KExtended\-Socket}!blockingMode@{blockingMode}}
\index{blockingMode@{blockingMode}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::blocking\-Mode ()}\label{classKExtendedSocket_a29}


Returns the current blocking mode for this socket. 

\begin{Desc}
\item[Returns:]true if in blocking mode \end{Desc}


Definition at line 709 of file kextsock.cpp.

References set\-Error().

Referenced by accept().\index{KExtendedSocket@{KExtended\-Socket}!setAddressReusable@{setAddressReusable}}
\index{setAddressReusable@{setAddressReusable}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Address\-Reusable (bool {\em enable})}\label{classKExtendedSocket_a30}


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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]if true, set address reusable \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]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. \end{Desc}


Definition at line 730 of file kextsock.cpp.

References set\-Error().

Referenced by connect(), and listen().\index{KExtendedSocket@{KExtended\-Socket}!addressReusable@{addressReusable}}
\index{addressReusable@{addressReusable}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::address\-Reusable ()}\label{classKExtendedSocket_a31}


Returns whether this socket's address can be reused. 

\begin{Desc}
\item[Returns:]true if the address can be reused \end{Desc}


Definition at line 763 of file kextsock.cpp.

References set\-Error().\index{KExtendedSocket@{KExtended\-Socket}!setIPv6Only@{setIPv6Only}}
\index{setIPv6Only@{setIPv6Only}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-IPv6Only (bool {\em enable})}\label{classKExtendedSocket_a32}


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.

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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]if true, no IPv4 translation will be performed; this socket will be restricted to IPv6 communication \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success, false on failure. \end{Desc}
\begin{Desc}
\item[See also:]{\bf local\-Address}{\rm (p.\,\pageref{classKExtendedSocket_a35})} to find out if this is an IPv6 socket \end{Desc}


Definition at line 786 of file kextsock.cpp.

References set\-Error().

Referenced by connect(), and listen().\index{KExtendedSocket@{KExtended\-Socket}!isIPv6Only@{isIPv6Only}}
\index{isIPv6Only@{isIPv6Only}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::is\-IPv6Only ()}\label{classKExtendedSocket_a33}


Returns the status of the v6-only flag for IPv6 sockets. 

\begin{Desc}
\item[Returns:]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. \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-IPv6Only}{\rm (p.\,\pageref{classKExtendedSocket_a32})} \end{Desc}


Definition at line 818 of file kextsock.cpp.

References set\-Error().\index{KExtendedSocket@{KExtended\-Socket}!setBufferSize@{setBufferSize}}
\index{setBufferSize@{setBufferSize}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Buffer\-Size (int {\em rsize}, int {\em wsize} = -2)\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a34}


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 \char`\"{}unlimited\char`\"{} size. The value of -2 means \char`\"{}no change\char`\"{}.

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.

Note 2: The {\bf closed()}{\rm (p.\,\pageref{classKBufferedIO_l1})} 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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rsize}]read buffer size \item[{\em wsize}]write buffer size \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success, false if this is not possible in this state (e.g. connection not established yet) \end{Desc}


Reimplemented from {\bf KBuffered\-IO} {\rm (p.\,\pageref{classKBufferedIO_a2})}.

Definition at line 848 of file kextsock.cpp.

References QObject::connect(), KBuffered\-IO::consume\-Read\-Buffer(), KBuffered\-IO::consume\-Write\-Buffer(), QIODevice::mode(), KBuffered\-IO::read\-Buffer\-Size(), and KBuffered\-IO::write\-Buffer\-Size().

Referenced by accept(), and connect().\index{KExtendedSocket@{KExtended\-Socket}!localAddress@{localAddress}}
\index{localAddress@{localAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  {\bf KSocket\-Address} $\ast$ KExtended\-Socket::local\-Address ()}\label{classKExtendedSocket_a35}


Returns the local socket address. 

\begin{Desc}
\item[Returns:]the local socket address, can be 0 if the connection has not been established yet \end{Desc}


Definition at line 950 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!peerAddress@{peerAddress}}
\index{peerAddress@{peerAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  {\bf KSocket\-Address} $\ast$ KExtended\-Socket::peer\-Address ()}\label{classKExtendedSocket_a36}


Returns the peer socket address. 

Use {\bf KExtended\-Socket::resolve()}{\rm (p.\,\pageref{classKExtendedSocket_e0})} to resolve this to a human-readable hostname/service or port. \begin{Desc}
\item[Returns:]the peer address, can be 0 if the connection has not been established yet or the socket is passive \end{Desc}


Definition at line 965 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!fd@{fd}}
\index{fd@{fd}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::fd () const\hspace{0.3cm}{\tt  [inline]}}\label{classKExtendedSocket_a37}


Returns the file descriptor. 

\begin{Desc}
\item[Returns:]the file descriptor. -1 if there is no fd yet. \end{Desc}


Definition at line 456 of file kextsock.h.

Referenced by KServer\-Socket::slot\-Accept().\index{KExtendedSocket@{KExtended\-Socket}!lookup@{lookup}}
\index{lookup@{lookup}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::lookup ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a38}


Performs lookup on the addresses we were given before. 

This will perform lookups on the bind addresses if they were given. \begin{Desc}
\item[Returns:]0 or an error. Do not rely on the values returned by lookup as of now. They are not specified. \end{Desc}


Definition at line 978 of file kextsock.cpp.

References set\-Error().

Referenced by connect(), and listen().\index{KExtendedSocket@{KExtended\-Socket}!startAsyncLookup@{startAsyncLookup}}
\index{startAsyncLookup@{startAsyncLookup}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::start\-Async\-Lookup ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a39}


Starts an asynchronous lookup for the addresses given. 

When the lookup is done, the lookup\-Ready signal will be emitted.

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 lookup\-Ready signal might be emitted by this function, so your code should be prepared for that.

One such case is when no\-Resolve flag is set. If this function is able to determine the results without queueing and the lookup failed, this function will return -1.

\begin{Desc}
\item[Returns:]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. \end{Desc}


Definition at line 1024 of file kextsock.cpp.

References QObject::connect(), lookup\-Finished(), and set\-Error().

Referenced by start\-Async\-Connect().\index{KExtendedSocket@{KExtended\-Socket}!cancelAsyncLookup@{cancelAsyncLookup}}
\index{cancelAsyncLookup@{cancelAsyncLookup}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::cancel\-Async\-Lookup ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a40}


Cancels any on-going asynchronous lookups. 



Definition at line 1097 of file kextsock.cpp.

Referenced by close\-Now().\index{KExtendedSocket@{KExtended\-Socket}!listen@{listen}}
\index{listen@{listen}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::listen (int {\em N} = 5)\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a41}


Place the socket in listen mode. 

The parameters are the same as for the system {\bf listen()}{\rm (p.\,\pageref{classKExtendedSocket_a41})} call. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em N}]the queue length for pending connections \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on system error (errno available) and -2 if this is not a passive\-Socket. \end{Desc}


Definition at line 1120 of file kextsock.cpp.

References KSocks::bind(), QObject::connect(), KSocks::listen(), lookup(), KSocks::self(), set\-Address\-Reusable(), set\-Error(), and set\-IPv6Only().

Referenced by accept(), and open().\index{KExtendedSocket@{KExtended\-Socket}!accept@{accept}}
\index{accept@{accept}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::accept ({\bf KExtended\-Socket} $\ast$\& {\em sock})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a42}


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.

Upon successful acception (i.e., this function returns 0), the newly created socket will be already connected. The socket will be unbuffered and {\bf ready\-Read()}{\rm (p.\,\pageref{classKAsyncIO_l0})} and {\bf ready\-Write()}{\rm (p.\,\pageref{classKAsyncIO_l1})} signals will be disabled.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]a pointer to an KExtended\-Socket variable \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, -1 on system error (errno set) and -2 if this is not a passive\-Socket and -3 if this took too long (time out) \end{Desc}


Definition at line 1189 of file kextsock.cpp.

References KSocks::accept(), blocking\-Mode(), d, listen(), KSocks::select(), KSocks::self(), set\-Blocking\-Mode(), set\-Buffer\-Size(), set\-Error(), and sockfd.\index{KExtendedSocket@{KExtended\-Socket}!connect@{connect}}
\index{connect@{connect}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::connect ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a43}


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: \begin{itemize}
\item {\bf ready\-Read}{\rm (p.\,\pageref{classKAsyncIO_l0})} and {\bf ready\-Write}{\rm (p.\,\pageref{classKAsyncIO_l1})} signals will be enabled only if {\bf enable\-Read}{\rm (p.\,\pageref{classKExtendedSocket_a64})} or {\bf enable\-Write}{\rm (p.\,\pageref{classKExtendedSocket_a65})} were called. You can still enable them by calling those functions, of course. \item {\bf closed()}{\rm (p.\,\pageref{classKBufferedIO_l1})} will only be sent if we are indeed reading from the input stream. That is, if this socket is buffering the input. See {\bf set\-Buffer\-Size}{\rm (p.\,\pageref{classKExtendedSocket_a34})}\end{itemize}
Note that, in general, functions inherited/overriden from {\bf KBuffered\-IO}{\rm (p.\,\pageref{classKBufferedIO})} will only work on buffered sockets, like bytes\-Available and bytes\-To\-Write. \begin{Desc}
\item[Returns:]The return values are: \begin{itemize}
\item 0: success \item -1: system error, errno was set accordingly \item -2: this socket cannot {\bf connect()}{\rm (p.\,\pageref{classKExtendedSocket_a43})}; this is a passive\-Socket. 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. \item -3: connection timed out \end{itemize}
\end{Desc}


Definition at line 1261 of file kextsock.cpp.

References KSocks::bind(), KSocks::connect(), connection\-Failed(), connection\-Success(), KStd\-Accel::end(), KSocks::has\-Working\-Async\-Connect(), lookup(), KSocks::select(), KSocks::self(), set\-Address\-Reusable(), set\-Blocking\-Mode(), set\-Buffer\-Size(), set\-Error(), and set\-IPv6Only().

Referenced by open().\index{KExtendedSocket@{KExtended\-Socket}!startAsyncConnect@{startAsyncConnect}}
\index{startAsyncConnect@{startAsyncConnect}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::start\-Async\-Connect ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a44}


Starts an asynchronous connect. 

This works exactly the same as {\bf connect}{\rm (p.\,\pageref{classKExtendedSocket_a43})}, except that the connection result won't be returned.

Note that those signals might be emitted before this function returns, so your code should be prepared for that condition. \begin{Desc}
\item[Returns:]0 on successful queueing of the connect or -1 on error. If this function returns 0, then the {\bf connection\-Success}{\rm (p.\,\pageref{classKExtendedSocket_l1})}() or the {\bf connection\-Failed}{\rm (p.\,\pageref{classKExtendedSocket_l2})}() signals will be emitted. \end{Desc}


Definition at line 1477 of file kextsock.cpp.

References QObject::connect(), lookup\-Finished(), and start\-Async\-Lookup().\index{KExtendedSocket@{KExtended\-Socket}!cancelAsyncConnect@{cancelAsyncConnect}}
\index{cancelAsyncConnect@{cancelAsyncConnect}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::cancel\-Async\-Connect ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a45}


Cancels any on-going asynchronous connection attempt. 



Definition at line 1512 of file kextsock.cpp.

Referenced by close\-Now().\index{KExtendedSocket@{KExtended\-Socket}!open@{open}}
\index{open@{open}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::open (int {\em mode} = IO\_\-Raw$|$IO\_\-Read\-Write)\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a46}


Implementation of {\bf QIODevice::open}() pure virtual function. 

This depends on the target host address already being there. If this is a passive\-Socket, this is identical to call {\bf listen()}{\rm (p.\,\pageref{classKExtendedSocket_a41})}; else, if this is not a passive\-Socket and no connection attempt is in progress, this is like {\bf connect()}{\rm (p.\,\pageref{classKExtendedSocket_a43})}. If one is in progress, this function will fail. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}]the open mode. Must be IO\_\-Raw $|$ IO\_\-Read\-Write \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false when an error occurred or the most was not correct \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 1532 of file kextsock.cpp.

References connect(), and listen().\index{KExtendedSocket@{KExtended\-Socket}!close@{close}}
\index{close@{close}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::close ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a47}


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 {\bf flush}{\rm (p.\,\pageref{classKExtendedSocket_a50})}() first, and then {\bf close\-Now}{\rm (p.\,\pageref{classKExtendedSocket_a48})}(). 

Reimplemented from {\bf QIODevice}.

Definition at line 1545 of file kextsock.cpp.

References KBuffered\-IO::closed(), KBuffered\-IO::read\-Buffer\-Size(), and KBuffered\-IO::write\-Buffer\-Size().\index{KExtendedSocket@{KExtended\-Socket}!closeNow@{closeNow}}
\index{closeNow@{closeNow}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::close\-Now ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a48}


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 {\bf KBuffered\-IO} {\rm (p.\,\pageref{classKBufferedIO_a1})}.

Definition at line 1579 of file kextsock.cpp.

References cancel\-Async\-Connect(), cancel\-Async\-Lookup(), KBuffered\-IO::closed(), KBuffered\-IO::read\-Buffer\-Size(), and KBuffered\-IO::write\-Buffer\-Size().

Referenced by reset(), and $\sim$KExtended\-Socket().\index{KExtendedSocket@{KExtended\-Socket}!release@{release}}
\index{release@{release}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::release ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a49}


Releases the socket and anything we have holding on it. 

The class cannot be used anymore. In other words, this is just like {\bf close\-Now()}{\rm (p.\,\pageref{classKExtendedSocket_a48})}, but it does not actually close the socket.

This is useful if you just want to connect and don't need the rest of the class.

Note that the buffers' contents will be discarded.

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.

References KBuffered\-IO::consume\-Read\-Buffer(), KBuffered\-IO::consume\-Write\-Buffer(), KBuffered\-IO::read\-Buffer\-Size(), and KBuffered\-IO::write\-Buffer\-Size().

Referenced by reset(), and KServer\-Socket::slot\-Accept().\index{KExtendedSocket@{KExtended\-Socket}!flush@{flush}}
\index{flush@{flush}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::flush ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a50}


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.

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.

This function does not touch the read buffer. You can empty it by calling {\bf read\-Block}{\rm (p.\,\pageref{classKExtendedSocket_a55})}() with a null destination buffer. 

Reimplemented from {\bf QIODevice}.

Definition at line 1640 of file kextsock.cpp.

References KBuffered\-IO::bytes\-Written(), KBuffered\-IO::consume\-Write\-Buffer(), QPtr\-List$<$ QByte\-Array $>$::first(), QPtr\-List$<$ QByte\-Array $>$::next(), KBuffered\-IO::out\-Buf, KSocks::self(), set\-Error(), KSocks::write(), and KBuffered\-IO::write\-Buffer\-Size().\index{KExtendedSocket@{KExtended\-Socket}!size@{size}}
\index{size@{size}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual Q\_\-ULONG KExtended\-Socket::size () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKExtendedSocket_a51}


Returns length of this socket. 

This call is not supported on sockets. \begin{Desc}
\item[Returns:]the length of this socket, or 0 if unsupported \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 632 of file kextsock.h.\index{KExtendedSocket@{KExtended\-Socket}!at@{at}}
\index{at@{at}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual Q\_\-ULONG KExtended\-Socket::at () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKExtendedSocket_a52}


Returns relative position from start. 

This call is not supported on sockets. \begin{Desc}
\item[Returns:]the relative position from the start, or 0 if unsupported \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 639 of file kextsock.h.\index{KExtendedSocket@{KExtended\-Socket}!at@{at}}
\index{at@{at}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KExtended\-Socket::at (int {\em i})\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKExtendedSocket_a53}


Returns true if we are at position. 

This is not supported on sockets. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em i}]the position to check \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if we art at the given position, or always true if unsupported. \end{Desc}


Definition at line 647 of file kextsock.h.\index{KExtendedSocket@{KExtended\-Socket}!atEnd@{atEnd}}
\index{atEnd@{atEnd}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KExtended\-Socket::at\-End () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKExtendedSocket_a54}


Returns true if we are at the end. 

This is not supported on sockets, but we always are at the end in a socket... \begin{Desc}
\item[Returns:]true if we are at the end. Always false if unsupported. \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 655 of file kextsock.h.\index{KExtendedSocket@{KExtended\-Socket}!readBlock@{readBlock}}
\index{readBlock@{readBlock}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-LONG KExtended\-Socket::read\-Block (char $\ast$ {\em data}, Q\_\-ULONG {\em maxlen})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a55}


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 {\bf set\-Blocking\-Mode}{\rm (p.\,\pageref{classKExtendedSocket_a28})}) 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.

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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]where we will write the read data to \item[{\em maxlen}]maximum length of data to be read \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of bytes effectively read, or a negative number in case or an error. If the {\tt data} param is not null, then this is also the number of bytes copied into that buffer. If the return value is different than {\tt maxlen}, then this function encountered a situation in which no more bytes were available. Subsequent calls might cause this function to one of these behaviours: \begin{itemize}
\item return an error, with EWOULDBLOCK system error, if we buffering or we are in non-blocking mode \item otherwise, it'll block This function returns 0, if the function detected end-of-file condition (socket was closed) \end{itemize}
\end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 1699 of file kextsock.cpp.

References KBuffered\-IO::consume\-Read\-Buffer(), KSocks::read(), KSocks::self(), and set\-Error().

Referenced by getch().\index{KExtendedSocket@{KExtended\-Socket}!writeBlock@{writeBlock}}
\index{writeBlock@{writeBlock}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-LONG KExtended\-Socket::write\-Block (const char $\ast$ {\em data}, Q\_\-ULONG {\em len})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a56}


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.

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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]the data to write \item[{\em len}]the length of data to write \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of bytes written from {\tt data} buffer. The return value might be less than {\tt len} if the output buffers cannot accommodate that many bytes and -1 in the case of an errro. \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 1744 of file kextsock.cpp.

References KBuffered\-IO::bytes\-Written(), KBuffered\-IO::feed\-Write\-Buffer(), KSocks::self(), set\-Error(), KSocks::write(), and KBuffered\-IO::write\-Buffer\-Size().

Referenced by putch().\index{KExtendedSocket@{KExtended\-Socket}!peekBlock@{peekBlock}}
\index{peekBlock@{peekBlock}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::peek\-Block (char $\ast$ {\em data}, uint {\em maxlen})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a57}


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.

If this socket is not buffered, this function will always return with 0 bytes copied.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]where to store the data \item[{\em maxlen}]how many bytes to copy, at most \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the number of bytes copied. 0 does not mean end-of-file condition. \end{Desc}


Implements {\bf KBuffered\-IO} {\rm (p.\,\pageref{classKBufferedIO_a7})}.

Definition at line 1798 of file kextsock.cpp.

References KBuffered\-IO::consume\-Read\-Buffer().\index{KExtendedSocket@{KExtended\-Socket}!unreadBlock@{unreadBlock}}
\index{unreadBlock@{unreadBlock}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::unread\-Block (const char $\ast$ {\em data}, uint {\em len})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a58}


Reimplementation of {\bf unread\-Block()}{\rm (p.\,\pageref{classKExtendedSocket_a58})} 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. \begin{Desc}
\item[Returns:]always -1 (error) \end{Desc}


Reimplemented from {\bf KBuffered\-IO} {\rm (p.\,\pageref{classKBufferedIO_a8})}.

Definition at line 1813 of file kextsock.cpp.

References set\-Error().\index{KExtendedSocket@{KExtended\-Socket}!bytesAvailable@{bytesAvailable}}
\index{bytesAvailable@{bytesAvailable}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::bytes\-Available () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a59}


Returns the number of available bytes yet to be read via {\bf read\-Block}{\rm (p.\,\pageref{classKExtendedSocket_a55})} and family of functions. 

Note: as of now, this only works on input-buffered sockets. This will change in the future \begin{Desc}
\item[Returns:]The number of available bytes, or -1 on error or -2 if this call is invalid in the current state. \end{Desc}


Reimplemented from {\bf KBuffered\-IO} {\rm (p.\,\pageref{classKBufferedIO_a3})}.

Definition at line 1820 of file kextsock.cpp.

References KBuffered\-IO::bytes\-Available().

Referenced by wait\-For\-More().\index{KExtendedSocket@{KExtended\-Socket}!waitForMore@{waitForMore}}
\index{waitForMore@{waitForMore}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::wait\-For\-More (int {\em msec})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a60}


Waits {\tt msec} 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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em msec}]milliseconds to wait \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]-1 in case of system error and -2 in case of invalid socket state \end{Desc}


Implements {\bf KBuffered\-IO} {\rm (p.\,\pageref{classKBufferedIO_a4})}.

Definition at line 1833 of file kextsock.cpp.

References bytes\-Available(), KSocks::select(), KSocks::self(), and set\-Error().\index{KExtendedSocket@{KExtended\-Socket}!getch@{getch}}
\index{getch@{getch}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::getch ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a61}


Gets a single character (unsigned char) from the stream. 

\begin{Desc}
\item[Returns:]the value of the character. Negative if there was an error. \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 1860 of file kextsock.cpp.

References read\-Block().\index{KExtendedSocket@{KExtended\-Socket}!putch@{putch}}
\index{putch@{putch}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::putch (int {\em ch})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a62}


Writes a single character (unsigned char) to the stream. 

All other bits will be ignored. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ch}]character to write, converted to char \end{description}
\end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 1871 of file kextsock.cpp.

References write\-Block().\index{KExtendedSocket@{KExtended\-Socket}!ungetch@{ungetch}}
\index{ungetch@{ungetch}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int KExtended\-Socket::ungetch (int)\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKExtendedSocket_a63}


Unreads one character from the stream. 

This is not possible on sockets. \begin{Desc}
\item[Returns:]always returns -1 on sockets. \end{Desc}


Reimplemented from {\bf QIODevice}.

Definition at line 777 of file kextsock.h.\index{KExtendedSocket@{KExtended\-Socket}!enableRead@{enableRead}}
\index{enableRead@{enableRead}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::enable\-Read (bool {\em enable})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a64}


Toggles the emission of the ready\-Read 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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]if true, the signal will be emitted \end{description}
\end{Desc}


Implements {\bf KAsync\-IO} {\rm (p.\,\pageref{classKAsyncIO_a0})}.

Definition at line 1911 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!enableWrite@{enableWrite}}
\index{enableWrite@{enableWrite}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::enable\-Write (bool {\em enable})\hspace{0.3cm}{\tt  [virtual]}}\label{classKExtendedSocket_a65}


Toggles the emission of the ready\-Write 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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]if true, the signal will be emitted \end{description}
\end{Desc}


Implements {\bf KAsync\-IO} {\rm (p.\,\pageref{classKAsyncIO_a1})}.

Definition at line 1926 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!lookupFinished@{lookupFinished}}
\index{lookupFinished@{lookupFinished}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::lookup\-Finished (int {\em count})\hspace{0.3cm}{\tt  [signal]}}\label{classKExtendedSocket_l0}


This signal is emitted whenever an asynchronous lookup process is done. 

The parameter {\tt count} tells \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em count}]the number of results \end{description}
\end{Desc}


Referenced by start\-Async\-Connect(), and start\-Async\-Lookup().\index{KExtendedSocket@{KExtended\-Socket}!connectionSuccess@{connectionSuccess}}
\index{connectionSuccess@{connectionSuccess}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::connection\-Success ()\hspace{0.3cm}{\tt  [signal]}}\label{classKExtendedSocket_l1}


This signal is emitted whenever we connected asynchronously to a host. 



Referenced by connect().\index{KExtendedSocket@{KExtended\-Socket}!connectionFailed@{connectionFailed}}
\index{connectionFailed@{connectionFailed}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::connection\-Failed (int {\em error})\hspace{0.3cm}{\tt  [signal]}}\label{classKExtendedSocket_l2}


This signal is emitted whenever our asynchronous connection attempt failed to all hosts listed. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em error}]the errno code of the last connection attempt \end{description}
\end{Desc}


Referenced by connect().\index{KExtendedSocket@{KExtended\-Socket}!readyAccept@{readyAccept}}
\index{readyAccept@{readyAccept}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::ready\-Accept ()\hspace{0.3cm}{\tt  [signal]}}\label{classKExtendedSocket_l3}


This signal is emitted whenever this socket is ready to accept another socket. 

\begin{Desc}
\item[See also:]{\bf accept()}{\rm (p.\,\pageref{classKExtendedSocket_a42})} \end{Desc}
\index{KExtendedSocket@{KExtended\-Socket}!setError@{setError}}
\index{setError@{setError}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::set\-Error (int {\em errorkind}, int {\em error})\hspace{0.3cm}{\tt  [protected]}}\label{classKExtendedSocket_b2}


Sets the error code. 



Definition at line 468 of file kextsock.cpp.

Referenced by accept(), address\-Reusable(), blocking\-Mode(), connect(), flush(), is\-IPv6Only(), listen(), lookup(), read\-Block(), set\-Address\-Reusable(), set\-Blocking\-Mode(), set\-IPv6Only(), start\-Async\-Lookup(), unread\-Block(), wait\-For\-More(), and write\-Block().\index{KExtendedSocket@{KExtended\-Socket}!setSocketStatus@{setSocketStatus}}
\index{setSocketStatus@{setSocketStatus}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KExtended\-Socket::set\-Socket\-Status (int {\em status})\hspace{0.3cm}{\tt  [protected]}}\label{classKExtendedSocket_b4}


Sets the socket status. 

For derived classes only. 

Definition at line 463 of file kextsock.cpp.\index{KExtendedSocket@{KExtended\-Socket}!resolve@{resolve}}
\index{resolve@{resolve}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::resolve (sockaddr $\ast$ {\em sock}, ksocklen\_\-t {\em len}, {\bf QString} \& {\em host}, {\bf QString} \& {\em port}, int {\em flags} = 0)\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e0}


Performs resolution on the given socket address. 

That is, tries to resolve the raw form of the socket address into a textual representation.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sockaddr}]the socket address \item[{\em host}]where the hostname will be written \item[{\em port}]where the service-port will be written \item[{\em flags}]the same flags as getnameinfo() \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, nonzero otherwise. \end{Desc}


Definition at line 2258 of file kextsock.cpp.

References QString::from\-Utf8().

Referenced by resolve().\index{KExtendedSocket@{KExtended\-Socket}!resolve@{resolve}}
\index{resolve@{resolve}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KExtended\-Socket::resolve ({\bf KSocket\-Address} $\ast$ {\em sock}, {\bf QString} \& {\em host}, {\bf QString} \& {\em port}, int {\em flags} = 0)\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e1}


Performs resolution on the given socket address. 

That is, tries to resolve the raw form of the socket address into a textual representation.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sockaddr}]the socket address \item[{\em host}]where the hostname will be written \item[{\em port}]where the service-port will be written \item[{\em flags}]the same flags as getnameinfo() \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 on success, nonzero otherwise. \end{Desc}


Definition at line 2273 of file kextsock.cpp.

References KSocket\-Address::data, KSocket\-Address::datasize, and resolve().\index{KExtendedSocket@{KExtended\-Socket}!lookup@{lookup}}
\index{lookup@{lookup}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List}$<$ {\bf KAddress\-Info} $>$ KExtended\-Socket::lookup (const {\bf QString} \& {\em host}, const {\bf QString} \& {\em port}, int {\em flags} = 0, int $\ast$ {\em error} = 0)\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e2}


Performs lookup on the given hostname/port combination and returns a list of matching addresses. 

The error code can be transformed into string by {\bf KExtended\-Socket::str\-Error}{\rm (p.\,\pageref{classKExtendedSocket_e5})}() with code of IO\_\-Lookup\-Error.

IMPORTANT: the result values of the {\bf QPtr\-List} must be deleted after use. So, if you don't copy the {\bf KAddress\-Info}{\rm (p.\,\pageref{classKAddressInfo})} objects, the best way to assure that is to call set\-Auto\-Delete(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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em host}]the hostname to look up \item[{\em port}]the port/service to look up \item[{\em flags}]flags to be used when looking up, {\bf Flags}{\rm (p.\,\pageref{classKExtendedSocket_w27})} \item[{\em error}]pointer to a variable holding the error code \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a list of KAddress\-Infos \end{Desc}


Definition at line 2279 of file kextsock.cpp.

References QPtr\-List::append().\index{KExtendedSocket@{KExtended\-Socket}!localAddress@{localAddress}}
\index{localAddress@{localAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSocket\-Address} $\ast$ KExtended\-Socket::local\-Address (int {\em fd})\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e3}


Returns the local socket address Remember to delete the returned object when it is no longer needed. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fd}]the file descriptor \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the local socket address or 0 if an error occurred. Delete after use. \end{Desc}


Definition at line 2320 of file kextsock.cpp.

References KSocks::getsockname(), KSocket\-Address::new\-Address(), and KSocks::self().\index{KExtendedSocket@{KExtended\-Socket}!peerAddress@{peerAddress}}
\index{peerAddress@{peerAddress}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSocket\-Address} $\ast$ KExtended\-Socket::peer\-Address (int {\em fd})\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e4}


Returns the peer socket address. 

Use {\bf KExtended\-Socket::resolve()}{\rm (p.\,\pageref{classKExtendedSocket_e0})} to resolve this to a human-readable hostname/service or port. Remember to delete the returned object when it is no longer needed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fd}]the file descriptor \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the peer socket address or 0 if an error occurred. Delete after use. \end{Desc}


Definition at line 2368 of file kextsock.cpp.

References KSocks::getpeername(), KSocket\-Address::new\-Address(), and KSocks::self().\index{KExtendedSocket@{KExtended\-Socket}!strError@{strError}}
\index{strError@{strError}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KExtended\-Socket::str\-Error (int {\em code}, int {\em syserr})\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e5}


Returns the representing text of this error code. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em code}]the error code, as seen in {\bf status()} \item[{\em syserr}]the system error, as from {\bf system\-Error()}{\rm (p.\,\pageref{classKExtendedSocket_a6})} \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the text for the given error code \end{Desc}


Definition at line 2414 of file kextsock.cpp.

References QString::from\-Local8Bit().\index{KExtendedSocket@{KExtended\-Socket}!setAddressReusable@{setAddressReusable}}
\index{setAddressReusable@{setAddressReusable}!KExtendedSocket@{KExtended\-Socket}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KExtended\-Socket::set\-Address\-Reusable (int {\em fd}, bool {\em enable})\hspace{0.3cm}{\tt  [static]}}\label{classKExtendedSocket_e6}


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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fd}]the file descriptor \item[{\em enable}]if true, set address reusable \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true on success, false on failure. \end{Desc}


Definition at line 748 of file kextsock.cpp.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kextsock.h\item 
kextsock.cpp\end{CompactItemize}
