source: trunk/MagicSoft/Control/SubsystemIO/TCPListener.ionotifier.hxx@ 9488

Last change on this file since 9488 was 1054, checked in by casaldaliga, 23 years ago
changed .H to .hxx in includes to work with new naming
File size: 1.6 KB
Line 
1#ifndef TCPLISTENER
2#define TCPLISTENER
3
4#include "IONotifier.hxx"
5#include <string>
6#include <sigc++/signal_system.h>
7
8using namespace SigC;
9//in Makefile#define MAXMSG 4096
10#include <netinet/in.h>
11//this is not properly a TCP server in the broadest sense (multiple clients). It should be called TCPListener(pending: change name consistently!). Only accepts connections from one client and responds driven by this client
12//TCPListener derives from libsigc++(signal/slot) Object to be able to connect signals to its methods
13class TCPListener: public Object {
14private:
15 int port;
16 bool newReceived;
17protected:
18 char receivedStream[MAXMSG];
19private:
20 char * clientAddress;
21 int clientPort;
22 //should be called commIsUp. Class Make up
23 bool comMode;
24public:
25 TCPListener (int port_);
26 ~TCPListener();
27protected:
28 //this public method should be capitalized for some consistency. Put the change should be propagated. class Make up!
29 virtual void process ();
30 string ReturnNew ();
31 void ClosingChannel();
32private:
33 void Accept ();
34 void Receive (); //Syncronous receive. If you are not sure there will be data to read, schedule this receive with IONotifier or something. Otherwise it will block
35
36
37//server socket(the one which listens to incoming connections) file descriptor
38 int socketItself;
39//socket opened here to parter the incoming connection. This is the one used to communicate
40 int channel;
41 struct sockaddr_in socketAddr;
42 IONotifier* notifierOfIncomingConn;
43 IONotifier* channelReadable;
44
45};
46
47#endif
Note: See TracBrowser for help on using the repository browser.