Rev 1026 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1026 | Rev 1203 | ||
|---|---|---|---|
| Line 29... | Line 29... | ||
| 29 | #include <stdexcept> |
29 | #include <stdexcept> |
| 30 | 30 | ||
| 31 | #include "../Socket/asyncsocket.h" |
31 | #include "../Socket/asyncsocket.h" |
| 32 | #include "../Threads/thread.h" |
32 | #include "../Threads/thread.h" |
| 33 | #include "../Tools/tools.h" |
33 | #include "../Tools/tools.h" |
| - | 34 | #include "../Threads/mutex.h" |
|
| 34 | 35 | ||
| 35 | class SocketThread : public Thread<SocketThread> |
36 | class SocketThread : public Thread<SocketThread> |
| 36 | { |
37 | { |
| 37 | public: |
38 | public: |
| 38 | SocketThread() { Thread<SocketThread>(); }; |
39 | SocketThread() { Thread<SocketThread>(); }; |
| 39 | SocketThread(string address, unsigned int port, unsigned int reconnectTimeout); |
40 | SocketThread(string address, unsigned int port, unsigned int reconnectTimeout); |
| 40 | ~SocketThread(); |
41 | ~SocketThread(); |
| 41 | 42 | ||
| 42 | unsigned int getId() { return myId; }; |
43 | unsigned long int getId() { return myId; }; |
| 43 | void send(string data); |
44 | void send(string data); |
| - | 45 | ||
| - | 46 | void startSocket(); |
|
| 44 | 47 | ||
| 45 | void run(); |
48 | void run(); |
| 46 | 49 | ||
| 47 | private: |
50 | private: |
| 48 | unsigned int myId; |
51 | unsigned long int myId; |
| 49 | AsyncSocket *mySocket; |
52 | AsyncSocket *mySocket; |
| - | 53 | ||
| - | 54 | static unsigned long int myCount; |
|
| - | 55 | static Mutex myCountMutex; |
|
| - | 56 | ||
| 50 | }; |
57 | }; |
| 51 | 58 | ||
| 52 | #endif /* _SOCKETTHREAD_H */ |
59 | #endif /* _SOCKETTHREAD_H */ |
| 53 | 60 | ||