Hi, I drop a visual lNet component (TLTCPComponent) onto a form and I try
connect to a server. For example I put this into the OnClick button event:
LTCPComponent1.Connect('192.168.1.34',67);

Under WinCE always is fired the OnConnect event although the addres and the
port are wrong (under Win32 the message 'Error on connect: connection
refused' is shown if the addres and the port are wrong and the OnConnect
event is not fired).

Why??

My code:

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
Dialogs,
  lNetComponents, StdCtrls, lNet;

type

  { TForm1 }

  TForm1 = class(TForm)
  Button1: TButton;
  LTCPComponent1: TLTCPComponent;
  procedure Button1Click(Sender: TObject);
  procedure LTCPComponent1Accept(aSocket: TLSocket);
  procedure LTCPComponent1Connect(aSocket: TLSocket);
  procedure LTCPComponent1Disconnect(aSocket: TLSocket);
  procedure LTCPComponent1Error(const msg: string; aSocket: TLSocket);
  procedure LTCPComponent1Receive(aSocket: TLSocket);
  private
  { private declarations }
  public
  { public declarations }
  end;

var
  Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
  LTCPComponent1.Connect('192.168.1.34',67);
end;

procedure TForm1.LTCPComponent1Accept(aSocket: TLSocket);
begin

end;

procedure TForm1.LTCPComponent1Connect(aSocket: TLSocket);
begin
  ShowMessage('conectado');
end;

procedure TForm1.LTCPComponent1Disconnect(aSocket: TLSocket);
begin

end;

procedure TForm1.LTCPComponent1Error(const msg: string; aSocket: TLSocket);
begin
  ShowMessage(msg);
end;

procedure TForm1.LTCPComponent1Receive(aSocket: TLSocket);
begin

end;

initialization
  {$I unit1.lrs}

end.
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to