E
echo_echo
Unregistered / Unconfirmed
GUEST, unregistred user!
问一个SOCKET的简单问题
有一台UNIX主机,现在想通过DELPHI编写前台程序,
启主机上的某个程序,由于刚刚学习SOCKET编程,
一知半解,想用下面的代码段来实现,可以都不可以成功,高手指点一二
procedure TForm1.B_sendClick(Sender: TObject);
var
f:TIniFile;
syspz_host:string;
begin
//读取INI文件的主机地址和端口配置文件路径
syspz_host:='./syspz_host.ini';
f:=TIniFile.Create(syspz_host);
addr:=f.ReadString('hostInfo','addr','');
xxport:=StrToInt(f.ReadString('hostInfo','port',''));
f.free;
with clientsocket1 do
begin
Active:=false;
Address:=addr;
Port:=xxport;
Active:=true;
end;//with
end;
procedure TForm1.ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
begin
statusbar1.Panels[0].Text:='已经连接成功';
with ClientSocket1 do
begin
Socket.SendText('test'); //主机登录名
Socket.SendText('test'); //密码
Socket.SendText('cd test'); //进入一个目录
Socket.SendText('sendsms'); //启程序程序
Active:=false;
end;
end;
有一台UNIX主机,现在想通过DELPHI编写前台程序,
启主机上的某个程序,由于刚刚学习SOCKET编程,
一知半解,想用下面的代码段来实现,可以都不可以成功,高手指点一二
procedure TForm1.B_sendClick(Sender: TObject);
var
f:TIniFile;
syspz_host:string;
begin
//读取INI文件的主机地址和端口配置文件路径
syspz_host:='./syspz_host.ini';
f:=TIniFile.Create(syspz_host);
addr:=f.ReadString('hostInfo','addr','');
xxport:=StrToInt(f.ReadString('hostInfo','port',''));
f.free;
with clientsocket1 do
begin
Active:=false;
Address:=addr;
Port:=xxport;
Active:=true;
end;//with
end;
procedure TForm1.ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
begin
statusbar1.Panels[0].Text:='已经连接成功';
with ClientSocket1 do
begin
Socket.SendText('test'); //主机登录名
Socket.SendText('test'); //密码
Socket.SendText('cd test'); //进入一个目录
Socket.SendText('sendsms'); //启程序程序
Active:=false;
end;
end;