• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TDESocket Class Reference

#include <ksock.h>

Inherits TQObject.

Public Slots

void slotWrite (int x)
 
void slotRead (int x)
 

Signals

void readEvent (TDESocket *s)
 
void writeEvent (TDESocket *s)
 
void closeEvent (TDESocket *s)
 

Public Member Functions

 TDESocket (int _sock) TDE_DEPRECATED
 
 TDESocket (const char *_host, unsigned short int _port, int timeOut=30) TDE_DEPRECATED
 
 TDESocket (const char *_path) TDE_DEPRECATED
 
virtual ~TDESocket ()
 
int socket () const
 
void enableRead (bool enable)
 
void enableWrite (bool enable)
 

Protected Member Functions

bool connect (const TQString &_host, unsigned short int _port, int timeout=0)
 
bool connect (const char *_path)
 

Protected Attributes

int sock
 

Detailed Description

A TCP/IP client socket.

Deprecated:
You can connect this socket to any Internet address.

This class is deprecated and will be removed in the future. For new programs, please use KExtendedSocket class.

The socket gives you three signals: When ready for reading, ready for writing or if the connection is broken. Using socket() you get a file descriptor which you can use with the usual UNIX function like write() or read(). If you have already such a socket identifier you can construct a TDESocket on this identifier.

If socket() delivers a value of -1 or less, the connection was not successful.

Author
Torben Weis weis@.nosp@m.uni-.nosp@m.frank.nosp@m.furt.nosp@m..de

Definition at line 87 of file ksock.h.

Constructor & Destructor Documentation

◆ TDESocket() [1/3]

TDESocket::TDESocket ( int  _sock)

Constructs a TDESocket with the provided file descriptor.

Parameters
_sockThe file descriptor to use.

Definition at line 110 of file ksock.cpp.

◆ TDESocket() [2/3]

TDESocket::TDESocket ( const char *  _host,
unsigned short int  _port,
int  timeOut = 30 
)

Creates a socket and connects to a host.

Parameters
_hostThe remote host to which to connect.
_portThe port on the remote host.
timeOutThe number of seconds waiting for connect (default 30).

Definition at line 124 of file ksock.cpp.

◆ TDESocket() [3/3]

TDESocket::TDESocket ( const char *  _path)

Connects to a UNIX domain socket.

Parameters
_pathThe filename of the socket.

Definition at line 130 of file ksock.cpp.

◆ ~TDESocket()

TDESocket::~TDESocket ( )
virtual

Destructor.

Closes the socket if it is still open.

Definition at line 269 of file ksock.cpp.

Member Function Documentation

◆ closeEvent

void TDESocket::closeEvent ( TDESocket *  s)
signal

Raised when the connection is broken.

Parameters
sthe TDESocket that triggered the event

◆ connect() [1/2]

bool TDESocket::connect ( const char *  _path)
protected

Definition at line 188 of file ksock.cpp.

◆ connect() [2/2]

bool TDESocket::connect ( const TQString &  _host,
unsigned short int  _port,
int  timeout = 0 
)
protected

Definition at line 202 of file ksock.cpp.

◆ enableRead()

void TDESocket::enableRead ( bool  enable)

Enables 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.

Parameters
enabletrue to enable reading signals

Definition at line 136 of file ksock.cpp.

◆ enableWrite()

void TDESocket::enableWrite ( bool  enable)

Enables the socket for writing.

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

Warning: If you forget to call enableWrite(false) when you are not ready to send data, you will get lots of writeEvent() signals, in the order of thousands a second !

Parameters
enabletrue to enable writing signals

Definition at line 152 of file ksock.cpp.

◆ readEvent

void TDESocket::readEvent ( TDESocket *  s)
signal

Data has arrived for reading.

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

Parameters
sthe TDESocket that triggered the event

◆ slotRead

void TDESocket::slotRead ( int  x)
slot

Connected to the readNotifier.

Called when the socket is ready for reading.

Parameters
xignored

Definition at line 169 of file ksock.cpp.

◆ slotWrite

void TDESocket::slotWrite ( int  x)
slot

Connected to the writeNotifier.

Called when the socket is ready for writing.

Parameters
xignored

Definition at line 180 of file ksock.cpp.

◆ socket()

int TDESocket::socket ( ) const
inline

Returns a file descriptor for this socket.

Returns
the file descriptor, or -1 when an error occurred.

Definition at line 119 of file ksock.h.

◆ writeEvent

void TDESocket::writeEvent ( TDESocket *  s)
signal

Socket is ready for writing.

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

Warning: If you forget to call enableWrite(false) when you are not ready to send data, you will get lots of writeEvent() signals, in the order of thousands a second !

Parameters
sthe TDESocket that triggered the event

Member Data Documentation

◆ sock

int TDESocket::sock
protected

Definition at line 220 of file ksock.h.


The documentation for this class was generated from the following files:
  • ksock.h
  • ksock.cpp

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.