Q&A

  • TServerSocket를 상속받아 OnClientConnect 에 기능추가 방법좀....


TServerSocket를 상속받아서 OnClientConnect 이벤트에

기능을 추가하려고 하는데요... 도저히 모르겠씁니다.

도와주십시오.



Client가 연결되면 "Client가 연결되었습니다!"라는 Message를

나타내는 컴포넌트인데 무엇이 잘못되었습니까?





============ SOURCE CODE =======================

unit OkbPicServer;



interface



uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

ScktComp;



type

TOkbPicServer = class(TServerSocket)



private

FOnClientConnect: TSocketNotifyEvent;

procedure SetOnClientConnect(const Value: TSocketNotifyEvent);

{ Private declarations }

protected

{ Protected declarations }

public

{ Public declarations }

constructor Create(AOwner : TComponent); override;

destructor Destroy; override;

published

{ Published declarations }

property OnClientConnect: TSocketNotifyEvent read FOnClientConnect write SetOnClientConnect;

end;





procedure Register;



implementation



procedure Register;

begin

RegisterComponents('OKB', [TOkbPicServer]);

end;





constructor TOkbPicServer.Create(AOwner: TComponent);

begin

inherited;



end;



destructor TOkbPicServer.Destroy;

begin

inherited;



end;



procedure TOkbPicServer.SetOnClientConnect(

const Value: TSocketNotifyEvent);

begin

FOnClientConnect := Value;

inherited;

ShowMessage('Client가 연결되었습니다!');

end;



end.

=======================END=================

0  COMMENTS