你在服务器上添加一个窗体,然后在上面添加一个Dcomconnection 然后: procedure TForm7.FormCreate(Sender: TObject); var Buffer:Array[1..32] of char; WSData:TWSAdata; Host:PHostEnt; begin if WSAstartup(2,WSData)<>0 then begin ShowMessage('WS2_32.DLL初始化失败!'); halt; end; try if GetHostName(@Buffer[1],32)<>0 then begin ShowMessage('没有得到主机名!'); halt; end; except ShowMessage('没有成功返回主机名'); halt; end; Host := GetHostByName(@Buffer[1]); dcomconnection1.ComputerName:=host.h_name; dcomconnection1.ServerName:='project3.myserver'; dcomconnection1.Connected:=true; end; 客户端断开连接后,这时能让应用服务器不回关闭了
你在服务器上添加一个窗体,然后在上面添加一个Dcomconnection
然后:
procedure TForm7.FormCreate(Sender: TObject);
var Buffer:Array[1..32] of char;
WSData:TWSAdata;
Host:PHostEnt;
begin
if WSAstartup(2,WSData)<>0 then
begin
ShowMessage('WS2_32.DLL初始化失败!');
halt;
end;
try
if GetHostName(@Buffer[1],32)<>0 then
begin
ShowMessage('没有得到主机名!');
halt;
end;
except
ShowMessage('没有成功返回主机名');
halt;
end;
Host := GetHostByName(@Buffer[1]);
dcomconnection1.ComputerName:=host.h_name;
dcomconnection1.ServerName:='project3.myserver';
dcomconnection1.Connected:=true;
end;
客户端断开连接后,这时能让应用服务器不回关闭了