📄 webserv1.h
字号:
//---------------------------------------------------------------------------
#ifndef WebServ1H
#define WebServ1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "WSocket.hpp"
#include "HttpSrv.hpp"
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
// This component is used for client connection instead of default one.
// This enables to add any data we need to handle our application.
// As this data is located in client component, each connected client has
// his own private data.
class TMyHttpConnection : public THttpConnection
{
protected:
char *FPostedDataBuffer; // Will hold dynamically allocated buffer
int FPostedDataSize; // Databuffer size
int FDataLen; // Keep track of received byte count.
public:
virtual __fastcall ~TMyHttpConnection();
};
class TAppBaseForm : public TForm
{
__published: // IDE-managed Components
TPanel *ToolsPanel;
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TLabel *ClientCountLabel;
TLabel *Label5;
TEdit *DocDirEdit;
TEdit *DefaultDocEdit;
TButton *StartButton;
TButton *StopButton;
TEdit *PortEdit;
TButton *ClearButton;
TCheckBox *DisplayHeaderCheckBox;
TMemo *DisplayMemo;
THttpServer *HttpServer1;
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall StartButtonClick(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall StopButtonClick(TObject *Sender);
void __fastcall ClearButtonClick(TObject *Sender);
void __fastcall HttpServer1ServerStarted(TObject *Sender);
void __fastcall HttpServer1ServerStopped(TObject *Sender);
void __fastcall HttpServer1ClientConnect(TObject *Sender,
TObject *Client, WORD Error);
void __fastcall HttpServer1ClientDisconnect(TObject *Sender,
TObject *Client, WORD Error);
void __fastcall HttpServer1HeadDocument(TObject *Sender,
TObject *Client, THttpGetFlag &Flags);
void __fastcall HttpServer1GetDocument(TObject *Sender,
TObject *Client, THttpGetFlag &Flags);
private: // User declarations
AnsiString FIniFileName;
BOOL FInitialized;
int FCountRequests;
void __fastcall Display(AnsiString Msg);
void __fastcall DisplayHeader(TMyHttpConnection *Client);
void __fastcall CreateVirtualDocument_time_htm(
TObject *Sender,
TObject *Client,
THttpGetFlag &Flags);
public: // User declarations
__fastcall TAppBaseForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TAppBaseForm *AppBaseForm;
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -