亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tcpsrv1.cpp

?? 文件名稱:新曦 我的資源 搜索軟件 源程序(Borland Delphi 7)說明
?? CPP
字號:
/*---------------------------------------------------------------------------

Author:       Fran鏾is Piette
Creation:     Sep 05, 1999 (From Delphi version dated aug 29, 1999)
Version:      1.00
Description:  Basic TCP server showing how to use TWSocketServer and
              TWSocketClient components.
EMail:        francois.piette@swing.be          http://www.rtfm.be/fpiette
              francois.piette@pophost.eunet.be  francois.piette@rtfm.be
Support:      Use the mailing list twsocket@rtfm.be See website for details.
Legal issues: Copyright (C) 1999-2000 by Fran鏾is PIETTE
              Rue de Grady 24, 4053 Embourg, Belgium. Fax: +32-4-365.74.56
              <francois.piette@pophost.eunet.be>

              This software is provided 'as-is', without any express or
              implied warranty.  In no event will the author be held liable
              for any  damages arising from the use of this software.

              Permission is granted to anyone to use this software for any
              purpose, including commercial applications, and to alter it
              and redistribute it freely, subject to the following
              restrictions:

              1. The origin of this software must not be misrepresented,
                 you must not claim that you wrote the original software.
                 If you use this software in a product, an acknowledgment
                 in the product documentation would be appreciated but is
                 not required.

              2. Altered source versions must be plainly marked as such, and
                 must not be misrepresented as being the original software.

              3. This notice may not be removed or altered from any source
                 distribution.

              4. You must register this software by sending a picture postcard
                 to the author. Use a nice stamp and mention your name, street
                 address, EMail address and any comment you like to say.
History:

---------------------------------------------------------------------------*/
#if __BORLANDC__ == 0x520     // BCB1 is BC5.20   BCB3 is BC5.30
    #define _WINSOCKAPI_      // Prevent winsock.h from being included
    #define s_addr S_addr
#endif
#include <vcl.h>
#include <vcl\inifiles.hpp>
#pragma hdrstop

#include "TcpSrv1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "WSocket"
#pragma link "WSocketS"
#pragma resource "*.dfm"
#define SectionWindow      "WindowTcpSrv"
#define KeyTop             "Top"
#define KeyLeft            "Left"
#define KeyWidth           "Width"
#define KeyHeight          "Height"
TTcpSrvForm *TcpSrvForm;
//---------------------------------------------------------------------------
__fastcall TTcpSrvForm::TTcpSrvForm(TComponent* Owner)
    : TForm(Owner)
{
    // Build Ini file name
    FIniFileName = LowerCase(ExtractFileName(Application->ExeName));
    FIniFileName = FIniFileName.SubString(1, FIniFileName.Length() - 3) + "ini";
}
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::FormShow(TObject *Sender)
{
    TIniFile    *IniFile;

    if (!FInitialized) {
        FInitialized     = TRUE;
        IniFile          = new TIniFile(FIniFileName);
        Top              = IniFile->ReadInteger(SectionWindow, KeyTop,    Top);
        Left             = IniFile->ReadInteger(SectionWindow, KeyLeft,   Left);
        Width            = IniFile->ReadInteger(SectionWindow, KeyWidth,  Width);
        Height           = IniFile->ReadInteger(SectionWindow, KeyHeight, Height);
        delete IniFile;
        DisplayMemo->Clear();
        // Delay startup code until our UI is ready and visible
        PostMessage(Handle, WM_APPSTARTUP, 0, 0);
    }
}
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::FormClose(TObject *Sender, TCloseAction &Action)
{
    TIniFile *IniFile;

    IniFile = new TIniFile(FIniFileName);
    IniFile->WriteInteger(SectionWindow, KeyTop,    Top);
    IniFile->WriteInteger(SectionWindow, KeyLeft,   Left);
    IniFile->WriteInteger(SectionWindow, KeyWidth,  Width);
    IniFile->WriteInteger(SectionWindow, KeyHeight, Height);
    delete IniFile;
}
//---------------------------------------------------------------------------
// Display a message in our display memo. Delete lines to be sure to not
// overflow the memo which may have a limited capacity.
void __fastcall TTcpSrvForm::Display(AnsiString Msg)
{
    int I;

    DisplayMemo->Lines->BeginUpdate();
    if (DisplayMemo->Lines->Count > 200) {
        for (I = 1; I <= 50; I++)
            DisplayMemo->Lines->Delete(0);
    }
    DisplayMemo->Lines->Add(Msg);
    DisplayMemo->Lines->EndUpdate();
}
//---------------------------------------------------------------------------
// This is our custom message handler. We posted a WM_APPSTARTUP message
// from FormShow event handler. Now UI is ready and visible.
void __fastcall TTcpSrvForm::WMAppStartup(TMessage Message)
{
    WSocketServer1->Proto       = "tcp";         // Use TCP protocol
    WSocketServer1->Port        = "telnet";      // Use telnet port
    WSocketServer1->Addr        = "0.0.0.0";     // Use any interface
    WSocketServer1->ClientClass = __classid(TTcpSrvClient); // Use our component
    WSocketServer1->Listen();                    // Start litening
    Display("Waiting for clients...");
}
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::WSocketServer1ClientConnect(TObject *Sender,
      TWSocketClient *Client, WORD Error)
{
    Display("Client connecting: " + ((TTcpSrvClient *)Client)->PeerAddr);
    ((TTcpSrvClient *)Client)->LineMode        = TRUE;
    ((TTcpSrvClient *)Client)->LineEdit        = TRUE;
    ((TTcpSrvClient *)Client)->OnDataAvailable = ClientDataAvailable;
    ((TTcpSrvClient *)Client)->OnBgException   = ClientBgException;
    ((TTcpSrvClient *)Client)->ConnectTime     = Now();
}
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::WSocketServer1ClientDisconnect(TObject *Sender,
      TWSocketClient *Client, WORD Error)
{
    Display("Client disconnecting: " + ((TTcpSrvClient *)Client)->PeerAddr + "    " +
            "Duration: " + FormatDateTime("hh:nn:ss",
            Now() - ((TTcpSrvClient *)Client)->ConnectTime));
}
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::ClientDataAvailable(TObject *Sender, WORD Error)
{
    TTcpSrvClient *Client;

    Client = (TTcpSrvClient *)Sender;

    // We use line mode. We will receive complete lines
    Client->RcvdLine = Client->ReceiveStr();
    // Remove trailing CR/LF
    while ((Client->RcvdLine.Length() > 0) &&
           ((Client->RcvdLine[Client->RcvdLine.Length()] == '\r') ||
            (Client->RcvdLine[Client->RcvdLine.Length()] == '\n'))) {
        Client->RcvdLine = Client->RcvdLine.SubString(1, Client->RcvdLine.Length() - 1);
    }
    Display("Received from " + Client->PeerAddr + ": '" + Client->RcvdLine + "'");
    ProcessData(Client);
}
//---------------------------------------------------------------------------
void __fastcall TTcpSrvForm::ProcessData(TTcpSrvClient *Client)
{
    int           I;
    TTcpSrvClient *AClient;

    // We could replace all those CompareText with a table lookup 
    if (CompareText(Client->RcvdLine, "exit") == 0)
        // We can't call Client.Close here because we will immediately
        // reenter DataAvailable event handler with same line because
        // a line is removed from buffer AFTER it has been processed.
        // Using CloseDelayed will delay Close until we are out of
        // current event handler.
        Client->CloseDelayed();
    else if (CompareText(Client->RcvdLine, "time") == 0)
        // Send server date and time to client
        Client->SendStr(DateTimeToStr(Now()) + "\r\n");
    else if (CompareText(Client->RcvdLine, "who") == 0) {
        // Send client list to client
        Client->SendStr("There are " + IntToStr(WSocketServer1->ClientCount) +
                        " connected users:\r\n");
        for (I = WSocketServer1->ClientCount - 1; I >= 0; I--) {
            AClient = (TTcpSrvClient *)(WSocketServer1->Client[I]);
            Client->SendStr(AClient->PeerAddr + ":" + AClient->PeerPort + " " +
                           DateTimeToStr(AClient->ConnectTime) + "\r\n");
        }
    }
    else if (CompareText(Client->RcvdLine, "exception") == 0)
        // This will trigger a background exception for client
        PostMessage(Client->Handle, WM_TRIGGER_EXCEPTION, 0, 0);
    else
        Client->SendStr("Unknown command: '" + Client->RcvdLine + "'\r\n");
}
//---------------------------------------------------------------------------
// This event handler is called when listening (server) socket experienced
// a background exception. Should normally never occurs.
void __fastcall TTcpSrvForm::WSocketServer1BgException(TObject *Sender,
      Exception *E, bool &CanClose)
{
    Display("Server exception occured: " + E->ClassName() + ": " + E->Message);
    CanClose = FALSE;  // Hoping that server will still work !
}
//---------------------------------------------------------------------------
// This event handler is called when a client socket experience a background
// exception. It is likely to occurs when client aborted connection and data
// has not been sent yet.
void __fastcall TTcpSrvForm::ClientBgException(TObject   *Sender,
                                          Exception *E,
                                          bool      &CanClose)
{
    Display("Client exception occured: " + E->ClassName() + ": " + E->Message);
    CanClose = TRUE;   // Goodbye client !
}
//---------------------------------------------------------------------------
__fastcall TTcpSrvClient::TTcpSrvClient(TComponent* Owner)
    : TWSocketClient(Owner)
{
}
//---------------------------------------------------------------------------

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人99久久亚洲综合精品| 亚洲mv大片欧洲mv大片精品| 日本一区二区不卡视频| 国产精品久久777777| 亚洲一区二区黄色| 一区二区三区欧美久久| 日本强好片久久久久久aaa| 激情综合色综合久久| 色吊一区二区三区| 日韩免费在线观看| 欧美年轻男男videosbes| 欧美四级电影在线观看| 欧美激情中文不卡| 免费一区二区视频| 99久久精品国产一区二区三区| 欧美精品一级二级| 欧美极品少妇xxxxⅹ高跟鞋| 亚洲一区二区在线视频| av高清久久久| 26uuu精品一区二区三区四区在线| 日韩你懂的在线观看| 亚洲柠檬福利资源导航| 国产一区视频在线看| 国产午夜精品一区二区三区嫩草| 91免费精品国自产拍在线不卡| 日韩欧美国产小视频| 亚洲视频一区在线| 国产乱对白刺激视频不卡| 欧美日高清视频| 国产精品护士白丝一区av| 免费成人在线视频观看| 欧美综合一区二区| 国产一本一道久久香蕉| 91精品婷婷国产综合久久性色| 亚洲私人黄色宅男| 国产一区二区在线观看视频| 欧美久久一二三四区| 亚洲视频资源在线| a美女胸又www黄视频久久| 久久久综合激的五月天| 黄色精品一二区| www国产精品av| 久久综合久久鬼色中文字| 激情av综合网| 久久久久久免费毛片精品| 国产乱子伦一区二区三区国色天香| 91久久精品一区二区三| 国产精品国产三级国产普通话三级 | 色狠狠一区二区三区香蕉| 国产精品剧情在线亚洲| 国产成人亚洲综合a∨猫咪| 欧美电影免费观看高清完整版在 | 亚洲色图一区二区三区| 韩国女主播一区| 久久爱www久久做| 欧美一区二区三区在线| 男人的天堂亚洲一区| 欧美精品亚洲一区二区在线播放| 玉米视频成人免费看| 色猫猫国产区一区二在线视频| 国产精品久久久久久久久免费樱桃 | 久久99国产乱子伦精品免费| 欧美日韩二区三区| 香蕉加勒比综合久久| 欧美在线啊v一区| 天天av天天翘天天综合网色鬼国产| 欧美性感一类影片在线播放| 精品免费一区二区三区| 日本美女一区二区三区视频| 欧美xxxx老人做受| av电影天堂一区二区在线观看| 久久天堂av综合合色蜜桃网| 国产91精品一区二区麻豆亚洲| 国产精品久久久久久久久免费樱桃 | 亚洲国产综合视频在线观看| 欧美妇女性影城| 五月婷婷久久综合| 精品成人一区二区三区四区| 成人短视频下载| 午夜精品久久久久久久| 精品对白一区国产伦| 国产麻豆视频一区二区| 亚洲男人的天堂在线aⅴ视频| 久久奇米777| 成人avav影音| 中文字幕日韩av资源站| 欧美日韩一区二区三区免费看| 日韩成人av影视| 国产欧美一区二区精品性色| 99v久久综合狠狠综合久久| 亚洲v精品v日韩v欧美v专区| 2020国产精品| 在线亚洲+欧美+日本专区| 日本一不卡视频| 日韩一区二区三区四区 | 久久综合色之久久综合| 99re热视频这里只精品| 亚洲成av人片在线观看| 国产女人aaa级久久久级| 国产一区二区美女诱惑| 亚洲国产精品久久艾草纯爱| 久久欧美中文字幕| 欧美日韩国产一级二级| 国产91精品一区二区麻豆网站| 天堂资源在线中文精品| 国产精品三级视频| 欧美大胆人体bbbb| 91老师片黄在线观看| 波波电影院一区二区三区| 国产一区二区三区不卡在线观看 | 亚洲国产成人av好男人在线观看| 国产精品成人网| 中文字幕色av一区二区三区| 国产精品女上位| 国产欧美日韩视频在线观看| av亚洲精华国产精华精华| 成人丝袜高跟foot| 日韩精品中文字幕一区| 亚洲成人一区二区在线观看| 亚洲激情综合网| 亚洲综合免费观看高清完整版在线 | 亚洲免费av观看| 亚洲自拍偷拍网站| 香蕉影视欧美成人| 久久99久久久久| 欧美日韩精品欧美日韩精品 | 国产精品白丝在线| 亚洲婷婷国产精品电影人久久| 亚洲欧美日韩人成在线播放| 一区二区三区国产豹纹内裤在线| 亚洲精品乱码久久久久久| 亚洲一区二区三区激情| 日韩经典一区二区| 国产精品夜夜嗨| 色综合色综合色综合| 欧美日本在线观看| 久久综合九色综合97婷婷| 国产精品午夜在线观看| 亚洲成人在线免费| 国产美女娇喘av呻吟久久| 99re66热这里只有精品3直播 | 色成年激情久久综合| 制服.丝袜.亚洲.中文.综合| 精品区一区二区| 国产精品美日韩| 欧美一区二区三区免费视频| 国产三级欧美三级日产三级99| 亚洲国产高清aⅴ视频| 亚洲一区二区三区不卡国产欧美| 极品少妇xxxx精品少妇| 色欧美片视频在线观看在线视频| 欧美欧美欧美欧美首页| 国产农村妇女毛片精品久久麻豆 | 国产一区二区三区四| 成人高清伦理免费影院在线观看| 欧美性猛交xxxx乱大交退制版| 欧美一区日韩一区| 国产精品久久毛片av大全日韩| 亚洲自拍偷拍图区| 丰满岳乱妇一区二区三区| 欧美性色综合网| 免费成人美女在线观看| 亚洲国产wwwccc36天堂| 国产麻豆精品theporn| 欧美日韩三级一区二区| 中文在线一区二区| 久久精品久久久精品美女| 91在线播放网址| 久久精品免费在线观看| 日韩不卡一区二区三区| 欧美在线观看视频在线| 国产精品美女久久久久久2018| 日韩精品1区2区3区| 欧美日韩一区小说| 亚洲女厕所小便bbb| 成人一道本在线| 久久人人超碰精品| 美女视频第一区二区三区免费观看网站| av中文字幕在线不卡| 国产情人综合久久777777| 极品少妇xxxx精品少妇| 制服丝袜亚洲网站| 日韩黄色片在线观看| 在线观看区一区二| 亚洲国产精品国自产拍av| 国产亚洲综合在线| 激情成人综合网| 在线成人av影院| 亚洲国产精品久久久男人的天堂| 99精品国产99久久久久久白柏| 国产午夜亚洲精品理论片色戒| 久99久精品视频免费观看| 91麻豆精品国产91| 午夜激情一区二区三区| 欧美日本在线看| 午夜电影网亚洲视频| 69av一区二区三区| 美女视频一区二区| 26uuu国产在线精品一区二区| 国产在线国偷精品免费看|