unit uROLocalChannel; {----------------------------------------------------------------------------} { RemObjects SDK Library - Core components } { } { compiler: Delphi 5 and up, Kylix 2 and up } { platform: Win32, Linux } { } { (c)opyright RemObjects Software. all rights reserved. } { } { Using this code requires a valid license of the RemObjects SDK } { which can be obtained at http://www.remobjects.com. } {----------------------------------------------------------------------------} {$I RemObjects.inc} interface uses {$IFDEF REMOBJECTS_TRIAL}uROTrial,{$ENDIF} Classes, uROClient, uROClientIntf, uROLocalServer; type TROLocalChannel = class(TROTransportChannel) private fServerChannel: TROLocalServer; protected function GetTransportObject: TObject; override; procedure IntDispatch(aRequest: TStream; aResponse: TStream); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; public procedure CheckProperties; override; constructor Create(aOwner : TComponent); override; published property ServerLocators; property DispatchOptions; property ServerChannel: TROLocalServer read fServerChannel write fServerChannel; property OnLoginNeeded; property OnSendStream; property OnReceiveStream; end; implementation uses uROClasses; { TROLocalChannel } procedure TROLocalChannel.CheckProperties; begin inherited; Check(ServerChannel = nil, Name + '.ServerChannel must be assigned.'); ServerChannel.CheckProperties; end; constructor TROLocalChannel.Create(aOwner: TComponent); begin inherited; ThreadSafe := true; end; function TROLocalChannel.GetTransportObject: TObject; begin Result := self; end; procedure TROLocalChannel.IntDispatch(aRequest, aResponse: TStream); begin CheckProperties; {$IFDEF DESIGNTIME} {$IFDEF MSWINDOWS} if csDesigning in ComponentState then raise EROIDEProblem.Create('We''re sorry, but the '+ClassName+' cannot be used inside the Delphi IDE at designtime.'); {$ENDIF MSWINDOWS} {$ENDIF DESIGNTIME} fServerChannel.SendRequest(aRequest, aResponse); end; procedure TROLocalChannel.Notification(AComponent: TComponent; Operation: TOperation); begin inherited; if (Operation=opRemove) and (AComponent=fServerChannel) then fServerChannel := NIL; end; initialization RegisterTransportChannelClass(TROLocalChannel); finalization UnRegisterTransportChannelClass(TROLocalChannel); end.