Files
Work/CapServer/hold/gensrv.hpp
2024-08-07 09:12:07 -04:00

42 lines
1013 B
C++

#ifndef _CAPSERVER_GENERICSERVER_HPP_
#define _CAPSERVER_GENERICSERVER_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _SOCKET_HOSTENT_HPP_
#include <socket/hostent.hpp>
#endif
#ifndef _SOCKET_SERVENT_HPP_
#include <socket/servent.hpp>
#endif
#ifndef _SOCKET_INETSOCKETADDRESS_HPP_
#include <socket/intsaddr.hpp>
#endif
#ifndef _SOCKET_SOCKET_HPP_
#include <socket/socket.hpp>
#endif
class GenericServer
{
public:
GenericServer(void);
virtual ~GenericServer();
WORD listen(const String &hostName,short portNum);
WORD receive(char &charData,BOOL waitForData=TRUE);
void close(void);
protected:
virtual void acceptHandler(SmartPointer<Socket> &socketControl);
virtual void message(const String &message);
virtual void message(Block<String> &msgData);
private:
enum{TimeOut=1000};
INETSocketAddress mInternetSocketAddress;
Socket mGenericControl;
WSASystem mWSASystem;
BOOL mIsRunning;
};
#endif