//---------------------------------------------------------------------------
#ifndef CtrlSocketH
#define CtrlSocketH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <ScktComp.hpp>
#include "CtrlElemento.h"
//---------------------------------------------------------------------------
TThreadList *pCache;
enum CtrlCOPs { CloseWINDOWS = 6660, QueryTIME = 6661, SettingSTATUS = 6669, sendLIST = 6662 };

class ThreadSocket : public TThread
{
private:
     void __fastcall Terminate(TObject *Sender); // this is the OnTerminate handler
protected:
    TClientSocket *ClientSocket;
    void __fastcall Execute();
    void __fastcall SocketDisconnect(TObject *Sender, TCustomWinSocket *Socket);
    void __fastcall SocketError(TObject *Sender, TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode);
    void __fastcall SocketConnect(TObject *Sender, TCustomWinSocket *Socket);
public:
    bool CtrlState;
    CtrlCOPs CtrlCOP;
    TDateTime CtrlTiempo;

    void __fastcall SetSocket( AnsiString IP_dst, int Socket );
    __fastcall ThreadSocket(bool CreateSuspended);
    TElemento *OWNER_Element;
    bool SocketCreated;
};
//---------------------------------------------------------------------------
//###########################################################################
//###########################################################################
//###########################################################################

#endif
