怎样执行远端linux服务器上的命令

olivehb 2003-11-19 04:56:20
delphi怎样实现执行远端linux服务器上的命令mkdir /ss。
对不起,我是新手,我用的是TTcpClient控件,下面是我的代码,总是有问题,receivebuf之后,好像buffer里什么都没有,下面是我的代码,该怎么改,谢谢
telnetcom.RemoteHost := ipaddr;
telnetcom.RemotePort := '23';
telnetcom.Active := true;

if telnetcom.Connect = true then
begin

count := 0;

while count <= 0 do
count := telnetcom.ReceiveBuf(buffer,6);

loginstr := copy(buffer,1,1);
buffer := 'root'+ #10 + #13;
telnetcom.SendBuf(buffer,length(buffer));
//count := telnetcom.ReceiveBuf(buffer,length(buffer));

buffer := '!@#qwe' + #13 + #10;
telnetcom.SendBuf(buffer,length(buffer));

buffer := 'mkdir /hb ' + #13 + #10;
telnetcom.SendBuf(buffer,length(buffer));
// if telnetcom.Connect = true then
end;

telnetcom.Disconnect ;
...全文
35 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
olivehb 2003-11-19
  • 打赏
  • 举报
回复
我只收到了一次数据,就是在连接的时候,等我输入用户名之后就再也没有收到过数据了,这是什么原因那?

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧