source: trunk/examples/network/infoprotocol/infoserver/server.h

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1/****************************************************************************
2** $Id: server.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
5**
6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation.
8**
9*****************************************************************************/
10
11#ifndef SERVER_H
12#define SERVER_H
13
14#include <qsocket.h>
15#include <qserversocket.h>
16
17#include "infodata.h"
18#include "serverbase.h"
19
20static const Q_UINT16 infoPort = 42417;
21
22
23/*
24 The ServerInfo class provides a small GUI for the server. It also creates the
25 SimpleServer and as a result the server.
26*/
27class ServerInfo : public ServerInfoBase
28{
29 Q_OBJECT
30public:
31 ServerInfo( Q_UINT16 port = infoPort, QWidget *parent = 0, const char *name = 0 );
32
33private slots:
34 void newConnect();
35};
36
37
38class SimpleServer : public QServerSocket
39{
40 Q_OBJECT
41public:
42 SimpleServer( Q_UINT16 port = infoPort, QObject* parent = 0, const char *name = 0 );
43 void newConnection( int socket );
44
45signals:
46 void newConnect();
47
48private:
49 InfoData info;
50};
51
52
53class ClientSocket : public QSocket
54{
55 Q_OBJECT
56public:
57 ClientSocket( int sock, InfoData *i, QObject *parent = 0, const char *name = 0 );
58
59private slots:
60 void readClient();
61 void connectionClosed();
62
63private:
64 QString processCommand( const QString& command );
65 InfoData *info;
66};
67
68
69#endif //SERVER_H
70
Note: See TracBrowser for help on using the repository browser.