00001 #ifndef FAITH_SERVERSOCKET_H
00002 #define FAITH_SERVERSOCKET_H
00003
00004 #include <faith/socket.h>
00005 #include <faith/net.h>
00006
00007 namespace Faith
00008 {
00009
00010 class FAITH_NET_EXPORT ServerSocket : public Faith::Object
00011 {
00012 Q_OBJECT
00013 int mSocket;
00014
00015 struct ServerSocketPrivate;
00016 ServerSocketPrivate *d;
00017
00018 Socket::SocketError mError;
00019
00020 public:
00024 ServerSocket(const Faith::String &address, int port, Object *parent=0);
00025
00029 ServerSocket(int port, Object *parent=0);
00030
00031 ~ServerSocket();
00032
00036 Socket::SocketError error() const { return mError; }
00037
00043 void setAddress(const Faith::String &address, int port);
00044
00048 bool listen();
00049
00050 public slots:
00054 void close();
00055
00056 private slots:
00057 void slotCanAccept();
00058
00059 signals:
00067 virtual void newConnection(int fd);
00068 };
00069
00070 }
00071
00072 #endif