捐赠 | 广告 | 注册 | 发布 | 上传 | 关于我们    
  粤ICP备10103342号-1 DELPHI盒子 | 盒子文章 | 盒子问答悬赏 | 最新更新 | 盒子检索 | 下载中心 | 高级搜索    
  精品专区 | 繁體中文 | 奖励公告栏 | 直通车账号登陆 | 关闭GOOGLE广告 | 临时留言    
盒子资源分类
全部展开 - 全部合拢
MIDAS 回调 (CallBack) 客户端实现信息广播
关键字:MIDAS CallBack Socket 回调 信息广播 接口
来 自:原创
平 台:Win9x,Win2k/XP/NT,Win2003 下载所需:0 火柴
深浅度:中级 完成时间:2006/3/23
发布者:hsgrass 发布时间:2006/3/23
编辑器:DELPHI7 语  种:简体中文
分 类:数据库 下载浏览:2187/13272
加入到我的收藏
下载错误报错
登陆以后才能下载
 用户名:
 密 码:
自动登陆(30天有效)
图片如果打不开,说明流量不够了,请稍候下载……
特徵:
1.在客戶端使用IDispatch使appserver可以作为接口使用.可以有代碼輸入提示啦,哈哈.
2.支援服務器廣播,由服務器觸發客戶端事件.(callback).

實現過程:
1.在服务器的TLB里面定义一个ICLIENT,在客户端应用程序实现ICLIENT的接口.
2.APPSERVER定义一个注册ICLIENT到服务器的方法,在服务器的需要的时候调用ICLIENT.即可以反映到客戶端.

說明: 
1.socketCOnnection.SupportCallBack := true; // 默認為支援.
2.运行前需要运行scktsrv.exe在delphi的BIN目錄下面.(:\Program Files\Borland\Delphi7\Bin\scktsrvr.exe)
3.socketconnection只能使用晚綁定(只能在執行期知道它的真正類型), 所以Iclient接口变量只能定义为Variant.

運行:
1.執行reg.bat
2.運行srv.exe
3.運行client.exe     connection, broadcast, 

缺点: 只能在一个APPSERVER上广播已登录的用户.

NOTE:
在寫服務器的時候將ServerUser.add和remove寫錯位置, 找了半小時.
要先註冊tlb文件,但那個loadReg用不了, 還是註冊後,再裝入.

Using dispatch interfaces with TCP/IP or HTTP
When you are using TCP/IP or HTTP, you can't use true early binding, but because the remote data module uses a dual interface, you can use the application server's dispinterface to improve performance over simple late binding. The dispinterface has the same name as the remote data module's interface, with the string 'Disp' appended. You can assign the 
AppServer property to a variable of this type to obtain the dispinterface. Thus:

var
  TempInterface: IMyAppServerDisp;
begin
  TempInterface :=IMyAppServerDisp(IDispatch(MyConnection.AppServer));
...
  TempInterface.SpecialMethod(x,y);
...
end;

Note

To use the dispinterface, you must add the _TLB unit that is generated when you save the type library to the uses clause of your client module.
Google
 
本站原创作品,未经作者许可,严禁任何方式转载;转载作品,如果侵犯了您的权益,请联系我们
龙脉加密锁 15元起 Grid++Report 报表 申请支付@网
 相关文章
没有相关文章
相关评论
共有评论11条 当前显示最后6条评论
renjie3733 2006/4/2 23:05:03
 TComponentFactory.Create(ComServer, ..,
    .., ciMultiInstance, tmFree);
delphiming 2006/4/3 11:30:56
to renjie3733 
我的服务层不是采用Free方式的.这样可以吗
hsgrass 2006/4/3 17:15:48
試試renjie3733說的, 
我看幫助上說,ADO用free模式會比較好.
錯誤的內容也說同一時間只能一個線程使用接口.
dfw@52003 2006/4/6 17:47:00
这个要受到Midas模式的限制,DCOM和Socket没问题,WebConnection 方式不行。
delphiming 2006/4/9 15:52:10
如果我的工程为了实现这个回调而改为tmFree模式,不会有太大的影响吧
jierxrh 2007/4/18 14:42:09
狂喜!但改为tmApartment模式卡死; 兄弟,能不能用tmApartment模式????
我要发表评论 查看全部评论
 
  DELPHI盒子版权所有 技术支持:深圳市麟瑞科技有限公司 1999-2024 V4.01 粤ICP备10103342号-1 更新RSS列表