用工具分析,客户端上填写用户、密码后登陆发出的数据为:
0000 01 A2 6F 40 56 31 38 33 66 31 00 54 72 61 76 65
0010 6C 23 32 69 30 34 00 3A 32 37 20 20 20 20 20 00
0020 6C 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00A0 00 00
我怎么通过INDY的IDtcpclinet模拟发送这一串16进制数据,实现登陆的目的!
谢谢,最好写出实现的代码!
0000 01 A2 6F 40 56 31 38 33 66 31 00 54 72 61 76 65
0010 6C 23 32 69 30 34 00 3A 32 37 20 20 20 20 20 00
0020 6C 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00A0 00 00
我怎么通过INDY的IDtcpclinet模拟发送这一串16进制数据,实现登陆的目的!
谢谢,最好写出实现的代码!
解决方案 »
- 如何用delphi把声卡的输入输出以及麦克风的输入同时录制成一个wav文件,能否详细介绍一下
- 如何将日期或时间以十六进制显示出来
- 怎样降低CPU利用率?????
- 我想在系统里集成一个FTP的客户端,有这方面经验的哥哥给小弟弟我点建议!(我用的是delphi7.0)
- 刚收到的网络招聘大会信息!!!
- 那有SourceInSigth或是这样看源码的工具下载?
- 在Delphi中如何获得计算机上网卡的MAC地址。
- 阿水想流到南方去,大家给点意见好吗
- 如何编程终结一个已经获得路径的进程
- delphi中的word开发
- 我想要一个控件它的功能和excel一样,具有和DBcombobox的下拉功能,同时能联数据库和打印预览,高手帮忙推荐!!!
- 深圳朋友,请进......
初始化:Remote的IP,Port,(延时),本地IP(DefaultIP),端口,还要激活
接受,Receive事件为IdUDPServerUDPRead事件中加入处理代码
发送消息:调用SendBuffer(Comm,Sizeof(comm))方法,把消息放入需要发送的内存即可,至于真正的发送交给控件自己去完成以下是代码的简单实例:unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, IdUDPServer, IdBaseComponent,
IdComponent, IdUDPBase, IdUDPClient,
IdSocketHandle;//这个IdSocketHandle需要手动自己加入type
TCommBlock = record
SenderName,
Msg :string[100];
end;
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
EdtRemote: TEdit;
EdtName: TEdit;
EdtRPort: TEdit;
EdtPort: TEdit;
Memo1: TMemo;
BitSet: TBitBtn;
Panel2: TPanel;
EdtMsg: TEdit;
Button1: TButton;
IdUDPClient1: TIdUDPClient;
IdUDPServer1: TIdUDPServer;
procedure BitSetClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationconst RECIEVETIMEOUT=5000; //定义延时,单位为毫秒
{$R *.dfm}procedure TForm1.BitSetClick(Sender: TObject);//初始化
begin
IdUDPClient1.Host:= EdtRemote.Text;//远程IP地址
IdUDPClient1.Port:=StrToInt(EdtRPort.Text);//远程端口
IdUDPClient1.ReceiveTimeout:=RECIEVETIMEOUT;//延时//下面是设置本地端口号
IdUDPServer1.DefaultPort:=StrToInt(EdtPort.Text);//本地IP
IdUDPServer1.Active:=true;//激活IdUDPServer 控件
Button1.Enabled:=True;
end;procedure TForm1.Button1Click(Sender: TObject);//发送消息
var
//define the struct of communication
Comm : TCommBlock;//comm是一个record的实例
//type
// TCommBlock = record
// SenderName,
// Msg :string[100];
// end;
/////////////////////即使说SenderName和Msg都是100个字节长
begin
Comm.SenderName:=EdtName.text;
Comm.Msg:=EdtMsg.Text;
Memo1.Lines.Add(Comm.SenderName+'说:'+Comm.Msg);
//////////////////////////////////////发送消息
IdUDPClient1.SendBuffer(comm,Sizeof(Comm));
///////////////////////////////////发送消息
end;procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
ABinding: TIdSocketHandle);////////////////////接到消息后的处理
var
Comm:TCommBlock;
begin
AData.ReadBuffer(Comm,AData.Size);//从AData中读取数据,放入到Comm结构中去
Memo1.Lines.Add(Comm.SenderName+' Say: '+Comm.Msg);//通过Comm结构分割数据,并显示end;end.
所以使用Id控件进行UDP通信的基本操作是:
初始化:Remote的IP,Port,(延时),本地IP(DefaultIP),端口,还要激活
接受,Receive事件为IdUDPServerUDPRead事件中加入处理代码
发送消息:调用SendBuffer(Comm,Sizeof(comm))方法,把消息放入需要发送的内存即可,至于真正的发送交给控件自己去完成
List: TStringList;
I: Integer;
Str: string;
Buf: Array of byte;begin
{for i:=0 to 200 do
Begin
Buf[i]:=char(0);
End; }
Str := '01 00 00 00 01 00 00 00 05 00 02 00 00 00 0A B9 D2 BB FA D5 CA ';
List := TStringList.Create;
ExtractStrings([' '], [], PChar(Str), List); // 分割
SetLength(Buf, List.Count );
for I := 0 to List.Count - 1 do
begin
Buf[I] :=StrToIntDef('$' + List[I], 0); // 赋给整数
Memo1.Lines.Add(IntToStr(Buf[I])); end;
List.Free;
IdTcpClient1.WriteBuffer(buf[0],sizeof(buf),false);
buf:=nil;
休息以下,看看电影吧,呵呵,免费的午餐!!