23 #include "tdelibs_export.h"
32 #include <sys/types.h>
34 #ifndef __STRICT_ANSI__
35 #define __STRICT_ANSI__
36 #define _WE_DEFINED_IT_
38 #include <sys/socket.h>
39 #ifdef _WE_DEFINED_IT_
40 #undef __STRICT_ANSI__
41 #undef _WE_DEFINED_IT_
46 #include <netinet/in.h>
47 class TQSocketNotifier;
49 #ifdef KSOCK_NO_BROKEN
57 typedef sockaddr_in ksockaddr_in;
58 #define get_sin_addr(x) x.sin_addr
59 #define get_sin_port(x) x.sin_port
60 #define get_sin_family(x) x.sin_family
61 #define get_sin_paddr(x) x->sin_addr
62 #define get_sin_pport(x) x->sin_port
63 #define get_sin_pfamily(x) x->sin_family
66 #define KSOCK_DEFAULT_DOMAIN PF_INET
68 class TDESocketPrivate;
69 class TDEServerSocketPrivate;
106 TDESocket(
const char *_host,
unsigned short int _port,
int timeOut = 30) KDE_DEPRECATED;
112 TDESocket(
const char * _path ) KDE_DEPRECATED;
133 void enableRead(
bool enable );
146 void enableWrite(
bool enable );
148 #ifdef KSOCK_NO_BROKEN
157 unsigned long ipv4_addr() KDE_DEPRECATED;
165 static
bool initSockaddr(ksockaddr_in *server_name, const
char *hostname,
unsigned short int port,
int domain = PF_INET) KDE_DEPRECATED;
205 void slotWrite(
int x);
214 void slotRead(
int x );
217 bool connect(
const TQString& _host,
unsigned short int _port,
int timeout = 0 );
218 bool connect(
const char *_path );
290 bool bindAndListen(
bool suppressFailureMessages =
false);
303 unsigned short int port();
305 #ifdef KSOCK_NO_BROKEN
313 unsigned long ipv4_addr();
320 virtual void slotAccept(
int );
335 bool init(
unsigned short int );
336 bool init(
const char *_path );
346 #ifdef TDESOCKET_BINARY_COMPAT_HACK
347 KDE_EXPORT
bool bindAndListen();
348 #endif // TDESOCKET_BINARY_COMPAT_HACK
353 TDEServerSocketPrivate *d;
Monitors a port for incoming TCP/IP connections.
int sock
The file descriptor for this socket.
int socket() const
Returns the file descriptor associated with the socket.
int socket() const
Returns a file descriptor for this socket.