zoukankan      html  css  js  c++  java
  • delphi tcp/ip IdTCPClient1实例一

    delphi tcp/ip IdTCPClient1实例一

    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
      IdTCPClient;

    type
      TForm1 = class(TForm)
        IdTCPClient1: TIdTCPClient;
        Button1: TButton;
        Edit1: TEdit;
        Edit2: TEdit;
        Label1: TLabel;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button1Click(Sender: TObject);
    begin
       IdTCPClient1.Host:='192.168.1.126';
       IdTCPClient1.Port:=168;


         IdTCPClient1.Connect();


          if edit1.Text='begin'  then
          begin
          IdTCPClient1.WriteLn('begin');
           showmessage(IdTCPClient1.ReadLn());
            end;
          if edit1.Text='end'  then
          IdTCPClient1.WriteLn('end');
          if edit1.Text='qx'  then
          IdTCPClient1.WriteLn('qx');


          IdTCPClient1.Disconnect;

    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
        IdTCPClient1.Disconnect;
    end;

    end.

    源码下载:http://download.csdn.net/source/1261880

  • 相关阅读:
    RabbitMQ资料
    在网页打开本地程序的思路
    HttpClient的巨坑
    webbrowser设置为相应的IE版本
    cpupower:Shows and sets processor power related values
    golang 国内环境配置
    OSX 创建 randisk(或称 tmpfs)
    Gentoo 搭遗
    ubuntu 去除开机背景
    fabric && cita 调研对比
  • 原文地址:https://www.cnblogs.com/fengju/p/6173884.html
Copyright © 2011-2022 走看看