delphi xe3里判断网络是否连接成功


delphi xe3里判断网络是否连接成功  

unit Unit2;

interface

uses
 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
 Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Web.Win.Sockets;

type
 TForm2 = class(TForm)
 TcpServer1: TTcpServer;
 procedure FormCreate(Sender: TObject);
 private
 { Private declarations }
 public
 { Public declarations }
 end;

var
 Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
 try
 TcpServer1.Active :=True ;
 ShowMessage('网络已连接')
 except
 ShowMessage('网络没连接');
 end;
end;

end.
联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678