23 #include "kdelibs_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
69 class KServerSocketPrivate;
91 class KDECORE_EXPORT
KSocket :
public TQObject
99 KSocket(
int _sock ) KDE_DEPRECATED;
106 KSocket(
const char *_host,
unsigned short int _port,
int timeOut = 30) KDE_DEPRECATED;
112 KSocket(
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 );
265 KServerSocket(
unsigned short int _port,
bool _bind =
true );
287 bool bindAndListen();
300 unsigned short int port();
302 #ifdef KSOCK_NO_BROKEN
310 unsigned long ipv4_addr();
317 virtual void slotAccept(
int );
332 bool init(
unsigned short int );
333 bool init(
const char *_path );
345 KServerSocketPrivate *d;