.TH "KServerSocket" 3 "28 Jan 2004" "kdecore Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KServerSocket \- \fBThis class or method is obsolete, it is provided for compatibility only.\fP Please use the more powerful \fBKExtendedSocket\fP class. Monitors a port for incoming TCP/IP connections.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <ksock.h>\fP
.PP
Inherits \fBQObject\fP.
.PP
.SS "Public Slots"

.in +1c
.ti -1c
.RI "virtual void \fBslotAccept\fP (int)"
.br
.RI "\fICalled when someone connected to our port. \fP"
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBaccepted\fP (\fBKSocket\fP *s)"
.br
.RI "\fIA connection has been accepted. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKServerSocket\fP (unsigned short int _port, bool _bind=true)"
.br
.RI "\fIConstructor. \fP"
.ti -1c
.RI "\fBKServerSocket\fP (const  char *_path, bool _bind=true)"
.br
.RI "\fICreates a UNIX domain server socket. \fP"
.ti -1c
.RI "virtual \fB~KServerSocket\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "bool \fBbindAndListen\fP ()"
.br
.RI "\fIBinds the socket and start listening. \fP"
.ti -1c
.RI "int \fBsocket\fP () const "
.br
.RI "\fIReturns the file descriptor associated with the socket. \fP"
.ti -1c
.RI "unsigned short int \fBport\fP ()"
.br
.RI "\fIReturns the port number which is being monitored. \fP"
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "bool \fBinit\fP (unsigned short int)"
.br
.ti -1c
.RI "bool \fBinit\fP (const  char *_path)"
.br
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "int \fBsock\fP"
.br
.RI "\fIThe file descriptor for this socket. \fP"
.in -1c
.SH "Detailed Description"
.PP 
\fBThis class or method is obsolete, it is provided for compatibility only.\fP Please use the more powerful \fBKExtendedSocket\fP class. Monitors a port for incoming TCP/IP connections. 

You can use a KServerSocket to listen on a port for incoming connections. When a connection arrived in the port, a \fBKSocket\fP is created and the signal accepted is raised. Make sure you always connect to this signal. If you don't the ServerSocket will create new KSocket's and no one will delete them!
.PP
If \fBsocket()\fP is -1 or less the socket was not created properly.
.PP
\fBAuthor:\fP
.RS 4
Torben Weis <weis@stud.uni-frankfurt.de> 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBksock.h\fP,v 1.53 2002/09/09 21:24:53 tjansen Exp 
.RE
.PP
.RE
.PP

.PP
Definition at line 241 of file ksock.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KServerSocket::KServerSocket (unsigned short int _port, bool _bind = true)"
.PP
Constructor. \fBParameters:\fP
.RS 4
\fI_port\fP the port number to monitor for incoming connections. 
.br
\fI_bind\fP if false you need to call \fBbindAndListen\fP yourself. This gives you the opportunity to set options on the socket. 
.RE
.PP
Definition at line 292 of file ksock.cpp.
.SS "KServerSocket::KServerSocket (const char * _path, bool _bind = true)"
.PP
Creates a UNIX domain server socket. \fBParameters:\fP
.RS 4
\fI_path\fP path used for the socket. 
.br
\fI_bind\fP if false you need to call \fBbindAndListen\fP yourself. This gives you the opportunity to set options on the socket. 
.RE
.PP
Definition at line 283 of file ksock.cpp.
.SS "KServerSocket::~\fBKServerSocket\fP ()\fC [virtual]\fP"
.PP
Destructor. Closes the socket if it was not already closed. Definition at line 419 of file ksock.cpp.
.SH "Member Function Documentation"
.PP 
.SS "bool KServerSocket::bindAndListen ()"
.PP
Binds the socket and start listening. This should only be called once when the constructor was called with _bind false. On error the socket will be closed. 
.PP
\fBReturns:\fP
.RS 4
true on success. false on error. 
.RE
.PP
Definition at line 329 of file ksock.cpp.
.PP
References QObject::connect(), slotAccept(), and sock.
.SS "int KServerSocket::socket () const\fC [inline]\fP"
.PP
Returns the file descriptor associated with the socket. \fBReturns:\fP
.RS 4
the file descriptor, -1 when an error occured during construction or \fBbindAndListen\fP 
.RE
.PP
Definition at line 281 of file ksock.h.
.PP
References sock.
.SS "unsigned short int KServerSocket::port ()"
.PP
Returns the port number which is being monitored. \fBReturns:\fP
.RS 4
the port number 
.RE
.PP
Definition at line 353 of file ksock.cpp.
.PP
References KSocketAddress::address(), kde_sockaddr_in6::sin6_port, and sock.
.SS "void KServerSocket::slotAccept (int)\fC [virtual, slot]\fP"
.PP
Called when someone connected to our port. Definition at line 400 of file ksock.cpp.
.PP
References accepted(), KExtendedSocket::fd(), KExtendedSocket::release(), and sock.
.PP
Referenced by bindAndListen().
.SS "void KServerSocket::accepted (\fBKSocket\fP * s)\fC [signal]\fP"
.PP
A connection has been accepted. It is your task to delete the \fBKSocket\fP if it is no longer needed.
.PP
WARNING: this signal is always emitted, even if you don't connect anything to it. That would mean memory loss, because the KSockets created go to oblivion. 
.PP
\fBParameters:\fP
.RS 4
\fIs\fP the socket that accepted 
.RE
.PP
Referenced by slotAccept().
.SH "Member Data Documentation"
.PP 
.SS "int \fBKServerSocket::sock\fP\fC [protected]\fP"
.PP
The file descriptor for this socket. sock may be -1. This indicates that it is not connected. Definition at line 326 of file ksock.h.
.PP
Referenced by bindAndListen(), port(), slotAccept(), and socket().

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