📄 sgip
字号:
'+sBind.LonginPass);<BR> memo1.Lines.Add('------------------Bind请求已发送----------------------');<BR> if
stream1.WaitForData(5000)
then<BR> begin<BR> fillchar(cHead,sizeof(cHead),0);<BR> fillchar(cbind_resp,sizeof(cBind_Resp),0);<BR> stream1.ReadBuffer(cHead,sizeof(cHead));<BR> stream1.ReadBuffer(cBind_resp,sizeof(cBind_resp));<BR> end;<BR> memo1.Lines.Add('cHead.MessageLength '+inttostr(ntohl(cHead.MessageLength)));<BR> bc:=ntohl(cHead.CommandId);<BR> memo1.Lines.Add('cHead.CommandId '+inttostr(bc));<BR> bc:=ntohl(cHead.SNumber1);<BR> memo1.Lines.Add('cHead.SNumber1
'+inttostr(bc));<BR> memo1.Lines.Add('cHead.SNumber2
'+inttostr(ntohl(cHead.SNumber2)));<BR> memo1.Lines.Add('cHead.SNumber3
'+inttostr(ntohl(cHead.SNumber3)));<BR> memo1.Lines.Add('cBind.LonginType
'+inttostr(cBind_resp.Result));<BR> stream1.Free;<BR>end;
<P></P>
<P>procedure TForm1.Button4Click(Sender:
TObject);<BR>//type<BR> {abc=packed
record<BR> head:SGIPHead;<BR> submit:xSubmit;<BR> end;}<BR>var<BR> FV_Date1_S,FV_Date2_S:string;<BR> i,SendSize:integer;<BR> //xxx:abc;<BR> stream2:twinsocketstream;<BR> abc,bc:longword;<BR> line1,line2:longword;<BR>begin<BR> stream2:=twinsocketstream.Create(clientsocket1.Socket,5000);<BR> SendSize:=0;<BR> memo1.Lines.Add('-------------------------submit--------------------------');<BR> if
not ClientSocket1.Active
then<BR> begin<BR> memo1.Lines.Add('-------------------客户端没有打开,submit失败-------------');<BR> exit;<BR> end;<BR> DateTimeToString(FV_Date1_S,'mmddhhnnss',now);<BR> DateTimeToString(FV_Date2_S,'zzz',now);<BR> FillChar(sSubmit,sizeof(sSubmit),0);<BR> FillChar(sHead,sizeof(sHead),0);<BR> with
ssubmit
do<BR> begin<BR> strpcopy(SPNumber,'4488');//;<BR> ChargeNumber :='8613188890924';<BR> UserCount
:=1;
//1-100<BR> {for i:=1 to UserCount
do<BR> begin<BR> //strpcopy(UserNumber[i-1].TelN,'8613065073355');//+T_Tel);// :array
of
TelCount; //长度为UserCount<BR> UserNumber[i-1].TelN:='8613011725853';<BR> end;}<BR> UserNumber:='8613188890924';<BR> CorpID:='41027';//CorpID:='4488';//strpcopy(CorpID,FV_corpID);<BR> ServiceType:='4488';//FV_SPNumber);//'4488';<BR> FeeType
:=1;<BR> FeeValue :='0';<BR> GivenValue :='0';<BR> AgentFlag
:=0;<BR> MOrelatetoMTFlag :=2;<BR> Priority :=0;<BR> ExpireTime :='';<BR> ScheduleTime :='';<BR> ReportFlag :=1;<BR> TP_pid :=0;<BR> tp_udhi
:=0;<BR> MessageCoding
:=15;<BR> MessageType
:=0;<BR> MessageLength
:=htonl(161);<BR> strpcopy(MessageContent,T_msg); //长度为 MessageLength;<BR> //Reserve
:='';<BR> end;<BR> {line1:=sizeof(sHead);<BR> line2:=sizeof(sSubmit);}<BR> with
sHead
do<BR> begin<BR> abc:=htonl(FV_SNumber);<BR> MessageLength:=htonl(sizeof(sHead)+sizeof(sSubmit)-3);<BR> CommandId:=htonl(SGIP_Submit);<BR> SNumber1:=abc;<BR> SNumber2:=htonl(StrToInt(FV_Date1_S));<BR> SNumber3:=htonl(StrToInt(FV_Date2_S));<BR> end;<SPAN
class=sft><BR><BR>____________________<BR><BR>
<P align=right>第2篇</P></SPAN></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff>
<TABLE class=sft style="FILTER: glow(color=#FFFFFF,strength=1)"
cellSpacing=0 cellPadding=3 width="100%" border=0>
<TBODY>
<TR>
<TD>dulcet99</TD></TR></TBODY></TABLE>头衔:侠客<BR>来自:山东<BR>发帖:53<BR>注册:2002年10月<BR><IMG
src="SGIP的delphi源码.files/24.gif"></IMG></TD>
<TD vAlign=top bgColor=#ffffff>发表于: 2002-11-1 20:39:53 <A
href="javascript:openWindow('viewuser.asp?name=dulcet99')"><IMG alt=查看作者档案
src="SGIP的delphi源码.files/profile.gif" border=0></A> <A
href="mailto:dulcet99@163.com"><IMG alt=给作者发电子邮件
src="SGIP的delphi源码.files/email.gif" border=0></A> <A
href="javascript:openWindow('%20')"><IMG alt=访问作者主页
src="SGIP的delphi源码.files/homepage.gif" border=0></A> <A
href="javascript:openWindow('viewip.asp?reply_id=3674')"><IMG alt=查看IP地址
src="SGIP的delphi源码.files/ip.gif" border=0></A> <A
href="javascript:openWindow('http://search.tencent.com/cgi-bin/friend/user_show_info?ln=35079175')"><IMG
alt=QQ号码:35079175 src="SGIP的delphi源码.files/qq.gif"
border=0></A> <IMG alt="MSN号码: "
src="SGIP的delphi源码.files/msn.gif"
border=0></A> <A
href="http://skybird.9s9s.com/bbs/post.asp?method=edit&reply_id=3674&auth=576&forum_title=&topic_title=SGIP%B5%C4delphi%D4%B4%C2%EB&forum_id=7&topic_id=1129&page=1"><IMG
alt=编辑修改 src="SGIP的delphi源码.files/edit.gif" border=0></A> <A
href="http://skybird.9s9s.com/bbs/delreply.asp?reply_id=3674&topic_title=SGIP%B5%C4delphi%D4%B4%C2%EB&forum_id=7&forum_title=☆协议理解☆"><IMG
alt=删除回复 src="SGIP的delphi源码.files/del.gif" border=0></A> <A
href="http://skybird.9s9s.com/bbs/post.asp?forum_id=7&reply_id=3674&method=reply&type=quotereply&forum_title=%A1%EE%D0%AD%D2%E9%C0%ED%BD%E2%A1%EE&topic_id=1129&topic_title=SGIP%B5%C4delphi%D4%B4%C2%EB&M="><IMG
alt=引用回复 src="SGIP的delphi源码.files/quote.gif" border=0></A>
<HR class=sft noShade SIZE=1>
<BR><BR> line1:=stream2.Write(shead,sizeof(shead));<BR> line2:=stream2.Write(sSubmit,sizeof(sSubmit)-3);<BR> if
stream2.WaitForData(5000)
then<BR> begin<BR> fillchar(cHead,sizeof(cHead),0);<BR> fillchar(cSubmit_Resp,sizeof(cSubmit_Resp),0);<BR> memo1.Lines.Add('read
submit Head
..............');<BR> try<BR> stream2.ReadBuffer(cHead,sizeof(cHead));<BR> stream2.ReadBuffer(cSubmit_Resp,sizeof(cSubmit_Resp));<BR> except<BR> on
e:exception
do<BR> memo1.Lines.Add(e.Message);<BR> end;<BR> memo1.Lines.Add('read
submit csubmit_resp
..............');<BR> //stream2.ReadBuffer(cBind_Resp,sizeof(cBind_resp));<BR> end;<BR> stream2.Free;<BR>end;
<P></P>
<P>procedure TForm1.ClientSocket1Read(Sender:
TObject;<BR> Socket:
TCustomWinSocket);<BR>var<BR> commandI,PackSize:Longword;<BR> Recv1I,Recv2I:integer;<BR>begin<BR> FillChar(sHead,sizeof(sHead),0);<BR> FillChar(sBind,sizeof(sBind),0);<BR> Recv1I:=socket.ReceiveBuf(sHead,sizeof(sHead));<BR> commandI:=ntohl(sHead.CommandId);<BR> PackSize:=ntohl(sHead.MessageLength);<BR> if
commandI=SGIP_UNBIND_RESP
then<BR> begin<BR> memo1.Lines.Add('------------------接收到SGIP_UNBIND_RESP请求------------------');<BR> exit;<BR> end;<BR> Recv2I:=socket.ReceiveBuf(sBind,sizeof(sBind));<BR> if
commandI=SGIP_BIND_RESP
then<BR> memo1.Lines.Add('---------------------SGIP_BIND_RESP------------------')<BR> else<BR> if
commandI=SGIP_SUBMIT_RESP
then<BR> memo1.Lines.Add('---------------------SGIP_SUBMIT_RESP----------------')<BR> else<BR> memo1.Lines.Add('---------------------'+inttostr(commandI)+'------------------');<BR> memo1.Lines.Add('MessageLength '+inttostr(ntohl(sHead.MessageLength)));<BR> memo1.Lines.Add('CommandId '+inttostr(commandI));<BR> memo1.Lines.Add('SNumber '+inttostr(ntohl(sHead.SNumber1))+'
'+<BR> inttostr(ntohl(sHead.SNumber2))+'
'+inttostr(ntohl(sHead.SNumber3)));<BR> memo1.Lines.Add('Result
'+inttostr(sBind_Resp.Result));<BR> memo1.Lines.add('------------------end
SGIP_UNBIND_RESP-------------------');<BR>end;</P>
<P>procedure TForm1.Button7Click(Sender:
TObject);<BR>var<BR> FV_Date1_S,FV_Date2_S:string;<BR> stream3:TWinSocketStream;<BR>begin<BR> Stream3:=TWinSocketStream.Create(clientSocket1.Socket,5000);<BR> memo1.Lines.Add('-------------------向服务端发送UnBIND请求--------------------');<BR> if
not ClientSocket1.Active
then<BR> begin<BR> memo1.Lines.Add('客户端没有打开');<BR> stream3.free;<BR> exit;<BR> end;<BR> DateTimeToString(FV_Date1_S,'mmddhhnnss',now);<BR> DateTimeToString(FV_Date2_S,'zzz',now);<BR> FillChar(sHead,sizeof(sHead),0);<BR> sHead.MessageLength:=htonl(sizeof(sHead));<BR> sHead.CommandId:=htonl(SGIP_UNBIND);<BR> sHead.SNumber1:=htonl(FV_SNumber);<BR> sHead.SNumber2:=htonl(StrToInt(FV_Date1_S));<BR> sHead.SNumber3:=htonl(StrToInt(FV_Date2_S));<BR> stream3.Write(sHead,20);<BR> FillChar(sHead,20,0);<BR> if
stream3.WaitForData(5000)
then<BR> begin<BR> stream3.ReadBuffer(sHead,20);<BR> end;<BR> stream3.Free;<BR>end;</P>
<P>procedure TForm1.ServerSocket1ClientRead(Sender:
TObject;<BR> Socket:
TCustomWinSocket);<BR> var<BR> RecvSize1,RecvSize2,DeSize:integer;<BR> commandI,MessageSize:LongWord;<BR>begin<BR> RecvSize1:=0;<BR> RecvSize2:=0;<BR> FillChar(cHead,SizeOf(cHead),0);</P>
<P> RecvSize1:=socket.ReceiveBuf(cHead,SizeOf(cHead));<BR> commandI:=ntohl(cHead.CommandId);<BR> MessageSize:=ntohl(cHead.MessageLength);<BR> if
commandI=SGIP_BIND
then<BR> begin<BR> memo1.Lines.Add('*********************接收到Bind请求*********************');<BR> FillChar(cBind,SizeOf(cBind),0);<BR> FillChar(cBind_Resp,SizeOf(cBind_Resp),0);<BR> RecvSize2:=Socket.ReceiveBuf(cBind,MessageSize-RecvSize1);<BR> if
(RecvSize2+RecvSize1)<>MessageSize
then<BR> begin<BR> memo1.Lines.Add('**********************bind数据接收错误*******************');<BR> exit;<BR> end;<BR> RecvSize2:=0;RecvSize1:=0;<BR> cHead.CommandId:=htonl(SGIP_BIND_RESP);<BR> cHead.MessageLength:=htonl(sizeof(cHead)+sizeof(cBind_Resp));<BR> cBind_Resp.Result:=0;<BR> RecvSize1:=Socket.SendBuf(cHead,SizeOf(cHead));<BR> RecvSize2:=Socket.SendBuf(cBind_Resp,SizeOf(cBind_Resp));<BR> if
(RecvSize1+RecvSize2)<>ntohl(cHead.MessageLength)
then<BR> begin<BR> memo1.Lines.Add('**********************响应bind请求错误***********************');<BR> exit;<BR> end;<BR> end<BR> else<BR> if
commandI=SGIP_DELIVER
then<BR> begin<BR> memo1.Lines.Add('********************接收到SGIP_DELIVER请求********************');<BR> DeSize:=SizeOf(cDeliver);<BR> FillChar(cDeliver,SizeOf(cDeliver),0);<BR> FillChar(cDeliver_Resp,SizeOf(cDeliver_Resp),0);<BR> RecvSize2:=Socket.ReceiveBuf(cDeliver,MessageSize-RecvSize1);<BR> if
(RecvSize2+RecvSize1)<>MessageSize then<SPAN
class=sft><BR><BR>____________________<BR><BR>
<P align=right>第3篇</P></SPAN></TD></TR>
<TR>
<TD vAlign=top bgColor=#e3e5e5>
<TABLE class=sft style="FILTER: glow(color=#FFFFFF,strength=1)"
cellSpacing=0 cellPadding=3 width="100%" border=0>
<TBODY>
<TR>
<TD>dulcet99</TD></TR></TBODY></TABLE>头衔:侠客<BR>来自:山东<BR>发帖:53<BR>注册:2002年10月<BR><IMG
src="SGIP的delphi源码.files/24.gif"></IMG></TD>
<TD vAlign=top bgColor=#e3e5e5>发表于: 2002-11-1 20:40:05 <A
href="javascript:openWindow('viewuser.asp?name=dulcet99')"><IMG alt=查看作者档案
src="SGIP的delphi源码.files/profile.gif" border=0></A> <A
href="mailto:dulcet99@163.com"><IMG alt=给作者发电子邮件
src="SGIP的delphi源码.files/email.gif" border=0></A> <A
href="javascript:openWindow('%20')"><IMG alt=访问作者主页
src="SGIP的delphi源码.files/homepage.gif" border=0></A> <A
href="javascript:openWindow('viewip.asp?reply_id=3675')"><IMG alt=查看IP地址
src="SGIP的delphi源码.files/ip.gif" border=0></A> <A
href="javascript:openWindow('http://search.tencent.com/cgi-bin/friend/user_show_info?ln=35079175')"><IMG
alt=QQ号码:35079175 src="SGIP的delphi源码.files/qq.gif"
border=0></A> <IMG alt="MSN号码: "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -