KSocket Class Reference

[kdecore Index] [kdecore Hierarchy] [Headers]


a TCP/IP client socket. More...

#include <ksock.h>

Inherits: QObject (qt)

Public Members

Public Slots

Protected Members

Signals

Private Members


Detailed Description

A TCP/IP client socket. You can connect this socket to any internet address.

The socket gives you three signals: When ready for reading/writing or if the connection is broken. Using socket() you get a file descriptor which you can use with usual unix commands like write(..) or read(...). If you have already such a socket identifier you can construct a KSocket on this identifier. If socket() delivers a value of -1 or less, the connection had no success.


KSocket( int _sock ) [public]

Create a KSocket with the provided file descriptor.

Parameters:
_sock the file descriptor to use.

KSocket( const char *_host, unsigned short int _port ) [public]

Create a socket and connect to a host.

Parameters:
_port the port on the remote host.
_host the remote host to which to connect.

KSocket( const char *_path ) [public]

Connects to a UNIX domain socket.

Parameters:
_path the filename of the socket

~KSocket() [public]

Destructor. Closes the socket if it is still open.

int socket() const [public]

Returns a file descriptor for this socket.

void enableRead( bool ) [public]

Enable the socket for reading.

If you enable read mode, the socket will emit the signal readEvent whenever there is something to read out of this socket.

void enableWrite( bool ) [public]

Enable the socket for writing.

If you enable write mode, the socket will emit the signal writeEvent whenever the socket is ready for writing.

unsigned long getAddr() [public]

Return address.

void slotWrite( int ) [public slot]

Connected to the writeNotifier.

void slotRead( int ) [public slot]

Connected to the readNotifier.

int sock[protected]

The file descriptor for this socket. sock may be -1. This indicates that it is not connected.

void readEvent( KSocket * ) [signal]

Data has arrived for reading.

This signal will only be raised if enableRead( TRUE ) was called first.

void writeEvent( KSocket * ) [signal]

Socket is ready for writing.

This signal will only be raised if enableWrite( TRUE ) was called first.

void closeEvent( KSocket * ) [signal]

Raised when the connection is broken.


  • Author: Torben Weis <weis@uni-frankfurt.de>
  • Version: $Id: ksock.h,v 1.20 1998/11/11 00:02:55 thufir Exp $
  • Documentation generated by root@darkstar.lst.de on Wed Sep 8 17:38:18 CEST 1999
Kdoc