23 #include "tdelibs_export.h"
28 #include <sys/types.h>
30 #ifndef __STRICT_ANSI__
31 #define __STRICT_ANSI__
32 #define _WE_DEFINED_IT_
34 #include <sys/socket.h>
35 #ifdef _WE_DEFINED_IT_
36 #undef __STRICT_ANSI__
37 #undef _WE_DEFINED_IT_
42 #include <netinet/in.h>
43 class TQSocketNotifier;
45 #ifdef KSOCK_NO_BROKEN
53 typedef sockaddr_in ksockaddr_in;
54 #define get_sin_addr(x) x.sin_addr
55 #define get_sin_port(x) x.sin_port
56 #define get_sin_family(x) x.sin_family
57 #define get_sin_paddr(x) x->sin_addr
58 #define get_sin_pport(x) x->sin_port
59 #define get_sin_pfamily(x) x->sin_family
62 #define KSOCK_DEFAULT_DOMAIN PF_INET
64 class TDESocketPrivate;
65 class TDEServerSocketPrivate;
102 TDESocket(
const char *_host,
unsigned short int _port,
int timeOut = 30) TDE_DEPRECATED;
108 TDESocket(
const char * _path ) TDE_DEPRECATED;
129 void enableRead(
bool enable );
142 void enableWrite(
bool enable );
144 #ifdef KSOCK_NO_BROKEN
153 unsigned long ipv4_addr() TDE_DEPRECATED;
161 static
bool initSockaddr(ksockaddr_in *server_name, const
char *hostname,
unsigned short int port,
int domain = PF_INET) TDE_DEPRECATED;
201 void slotWrite(
int x);
210 void slotRead(
int x );
213 bool connect(
const TQString& _host,
unsigned short int _port,
int timeout = 0 );
214 bool connect(
const char *_path );
286 bool bindAndListen(
bool suppressFailureMessages =
false);
299 unsigned short int port();
301 #ifdef KSOCK_NO_BROKEN
309 unsigned long ipv4_addr();
316 virtual void slotAccept(
int );
331 bool init(
unsigned short int );
332 bool init(
const char *_path );
342 #ifdef TDESOCKET_BINARY_COMPAT_HACK
343 TDE_EXPORT
bool bindAndListen();
349 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.
void accepted(TDESocket *s)
A connection has been accepted.
int socket() const
Returns a file descriptor for this socket.
void closeEvent(TDESocket *s)
Raised when the connection is broken.
void readEvent(TDESocket *s)
Data has arrived for reading.
void writeEvent(TDESocket *s)
Socket is ready for writing.