⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp_dll.pas

📁 SPServer.rar一个基于TCP/IP监听发送代码
💻 PAS
📖 第 1 页 / 共 2 页
字号:
           SockAddressLink(pHandle,pHand,pIPAddress,pSPNumber,1);
           SockAddressLink(0,0,pIPAddress,'',4);
           ResultValue:=h4A;
          end;
       end;
   if s=h02
      then begin
        MsgResult:=IntToStr(GetHostPort);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h03
      then begin
        MsgResult:=IntToStr(GetREC_UPT);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h04
      then begin
        MsgResult:=IntToStr(GetSND_UPT);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h05
      then begin
        MsgResult:=BoolToStr(GetSeurity);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h06
      then begin
        MsgResult:=BoolToStr(GetWarning);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h07
     then begin
        MsgResult:=GetMangPhone;
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h08
      then begin
        MsgResult:=IntToStr(GetAnswerTime);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h09
      then begin
        MsgResult:=IntToStr(GetInterval);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h0A
      then begin
        MsgResult:=IntToStr(GetExpireTime);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h0B
      then begin
        MsgResult:=IntToStr(GetSenAnswTime);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h0C
      then begin
        MsgResult:=BoolToStr(GetCurLogChk);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h0D
      then begin
        MsgResult:=IntToStr(ReadCXRecord);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h0E
      then begin
        MsgResult:=IntToStr(ReadSNDRecord);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h0F
      then begin
        MsgResult:=IntToStr(GetCharge);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h10
      then begin
        MsgResult:='□服务器当前时间:'+ TimeToStr(Time);
        MsgResult:=Get_Time+MsgResult;
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h11
      then begin
        MsgResult:=GetSvcTypeTran;
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h12
      then begin
        MsgResult:=GetSPSvcType;
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h13
      then begin
        MsgResult:=BoolToStr(GetReSend);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h14
      then begin
        MsgResult:=IntToStr(GetSendTry);
        CommandID:=s;
        ResultValue:=h46;
      end;
   if s=h15
      then begin
       CommandID:=h15;
       try
        if StrToInt(pContent)<=65535 then
         begin
          SetHostPort(StrToInt(pContent));
          frm_smServer.ServerReceiveSend.Active:=False;
          frm_smServer.ServerReceiveSend.Port:=GetHostPort;
          frm_smServer.ServerReceiveSend.Active:=True;
          frm_smServer.sgr3.RowCount:=2;
          frm_smServer.sgr3.Rows[1].Clear;
          ClearLink;
          CommandID:='';
         end else ResultValue:=h45;
         except
          on exception do
            ResultValue:=h48;
         end;
        end;
   if s=h16
      then begin
       CommandID:=h16;
       try
        if StrToInt(pContent)<=10 then
         begin
          SetREC_UPT(StrToInt(pContent));
          REC_UPT:=GetREC_UPT;
          ResultValue:=h47;
         end else ResultValue:=h45;
         except
          on exception do
           ResultValue:=h48;
         end;
        end;
   if s=h17
      then begin
      CommandID:=h17;
       try
        if StrToInt(pContent)<=10 then
         begin
          SetSND_UPT(StrToInt(pContent));
          SND_UPT:=GetSND_UPT;
          ResultValue:=h47;
         end else ResultValue:=h45;
         except
          on Exception do
           ResultValue:=h48;
         end;
        end;
   if s=h18
      then begin
      CommandID:=h18;
       try
         SetSeurity(StrToBool(pContent));
         ResultValue:=h47;
        except
         on exception do
          ResultValue:=h48
         end;
        end;
   if s=h19
      then begin
      CommandID:=h19;
       try
         SetWarning(StrToBool(pContent));
         ResultValue:=h47;
        except
         on exception do
          ResultValue:=h48
         end;
        end;
   if s=h1A
      then begin
      CommandID:=h1A;
       try
        for i:=1 to Length(pContent) do
         if pContent[i] in ['0'..'9'] then
          begin
           SetMangPhone(pContent);
           MangPhone:=GetMangPhone;
           ResultValue:=h47;
          end else ResultValue:=h45;
        except
         on exception do
          ResultValue:=h48
         end;
        end;
   if s=h1B
      then begin
      CommandID:=h1B;
       try
        if (StrToInt(pContent)<=10000)and
           (StrToInt(pContent)>=500) then
         begin
          SetAnswerTime(StrToInt(pContent));
          frm_smServer.Timer_Rec.Interval := GetAnswerTime;
          ResultValue:=h47;
         end else ResultValue:=h45;
        except
         on exception do
          ResultValue:=h48;
         end;
        end;
   if s=h1C
      then begin
      CommandID:=h1C;
       try
        if StrToInt(pContent)<=20 then
         begin
          SetInterval(StrToInt(pContent));
          Interval:=GetInterval;
          ResultValue:=h47;
         end else ResultValue:=h45;
        except
         on exception do
          ResultValue:=h48;
         end;
        end;
   if s=h1D
      then begin
      CommandID:=h1D;
       try
        if StrToInt(pContent)<=1440 then
         begin
          SetExpireTime(StrToInt(pContent));
          ExpireTime:=GetExpireTime;
          ResultValue:=h47;
         end else ResultValue:=h45;
        except
         on exception do
           ResultValue:=h48;
         end;
       end;
   if s=h1E
      then begin
       try
       CommandID:=h1E;
        if StrToInt(pContent)<=10000 then
         begin
          SetSenAnswTime(StrToInt(pContent));
          frm_smServer.Timer_Send.Interval := GetSenAnswTime;
          ResultValue:=h47;
         end else ResultValue:=h45;
         except
          on exception do
           ResultValue:=h48;
        end;
      end;
   if s=h1F
      then begin
      CommandID:=h1F;
       try
        SetCurLogChk(StrToBool(pContent));
        CurLogChk:=GetCurLogChk;
        ResultValue:=h47;
        except
         on exception do
          ResultValue:=h48;
         end;
        end;
   if s=h20
      then begin
      CommandID:=h20;
       try
        if (StrToInt(pContent)=1)or(StrToInt(pContent)=0) then
         begin
          SetCharge(StrToInt(pContent));
          ResultCharegNo:=GetCharge;
          ResultValue:=h47;
         end else ResultValue:=h45;
        except
         on exception do
          ResultValue:=h48;
         end;
        end;
   if s=h21
     then begin
     CommandID:=h21;
      try
        if (Pos(':',pContent)>0)and(pContent<='23:59')
        then begin
          SetTime(pContent);
          SendTime:=Get_Time;
          ResultValue:=h47;
         end else ResultValue:=h45;
          except
           on exception do
            ResultValue:=h48;
        end;
     end;
   if s=h22 then   //待定
   if s=h23 then   //待定
   if s=h24
      then begin
       CommandID:=h24;
       try
        SetReSend(StrToBool(pContent));
        ResultValue:=h47;
        except
         on exception do
          ResultValue:=h45;
         end;
        end;
   if s=h25
      then begin
      CommandID:=h25;
       try
        if (StrToInt(pContent)<=3)and(StrToInt(pContent)>=0) then
         begin
          SetSendTry(StrToInt(pContent));
          ResultValue:=h47;
         end else ResultValue:=h45;
         except
          on exception do
           ResultValue:=h48;
         end;
      end;
   if s=h26
      then begin
       CommandID:=h26;
       MsgResult:='服务器工作状态:'+str_Out('',4)+#13+#13+
                   '收到记录数:'+IntToStr(MsgReceive)+#13+#13+
                   '成功记录数:'+IntToStr(MsgRightNum)+#13+#13+
                   '失败记录数:'+IntToStr(FailRecord)+#13+#13+
                   '缓冲记录数:'+IntToStr(BufferRecord)+#13+#13+
                   '运行记录数:'+IntToStr(vRun);
        ResultValue:=h4E;
       end;
   if s=h27        //单条信息发送
     then begin
      CommandID:=h27;
       if not CheckPhone(11,Trim(pDestNo))
         then begin
           ResultValue:=h45;
           Exit;
         end;
        if not (CheckPhone(11,pChargeNo)or(pChargeNo<>'0')or(pChargeNo<>''))
         then begin
           ResultValue:=h45;
           Exit;
         end;
        if SearchSvcType(aSvcType,1)<>1
         then begin
           ResultValue:=h45;
           Exit;
         end;
         if Length(pContent)=0
          then begin
           ResultValue:=h45;
           Exit;
          end;
        PostMess(2,1,pDestNo,pChargeNo,pSvcType,Now,pContent,pSPNumber);
        ResultValue:=h4C;
      end;
   if s=h28       //信息群发
     then begin
      CommandID:=h28;
        if not (pChargeNo<>'0')or(pChargeNo<>'')
         then begin
           ResultValue:=h45;
           Exit;
         end;
        if SearchSvcType(aSvcType,1)<>1
         then begin
           ResultValue:=h45;
           Exit;
         end;
         if Length(pContent)=0
          then begin
           ResultValue:=h45;
           Exit;
          end;
        PostMess(2,0,pDestNo,pChargeNo,pSvcType,Now,pContent,pSPNumber);
        ResultValue:=h4C;
      end;
   if s=h29 then PostMess(1,0,'','',pSvcType,Now,pContent,'');
   if s=h2A then
     begin
      try
        CommandID:=h2A;
        if StrToInt(pContent)<=10000 then
         begin
          SetTimeCycle(StrToInt(pContent));
          frm_smServer.tTimeCycle.Interval := GetTimeCycle;
          ResultValue:=h47;
         end else ResultValue:=h45;
         except
          on exception do
           ResultValue:=h48;
        end;
     end;
   if s=h2B then
     begin
      try
        CommandID:=h2B;
        if (StrToInt(pContent)>0)and(StrToInt(pContent)<32) then
         begin
          SetFeeDate(StrToInt(pContent));
          FeeDate:=GetFeeDate;
          ResultValue:=h47;
         end else ResultValue:=h45;
         except
          on exception do
           ResultValue:=h48;
        end;
     end;
   if s=h2C then
     begin
      try
        CommandID:=h2C;
        if (Pos(':',pContent)>0)and(pContent<='23:59')
        then begin
          SetFeeTime(pContent);
          FeeTime:=GetFeeTime;
          ResultValue:=h47;
         end else ResultValue:=h45;
          except
           on exception do
            ResultValue:=h48;
        end;
     end;
   if s=h2D then
     begin
     
     end;
   if s=h2E then
     begin
      MsgResult:=IntToStr(GetTimeCycle);
      CommandID:=s;
      ResultValue:=h46;
     end;
   if s=h2F then
     begin
      MsgResult:=GetSPNumber;
      CommandID:=s;
      ResultValue:=h46;
     end;
   if s=h30 then
     begin
      MsgResult:=GetFeeTime;
      CommandID:=s;
      ResultValue:=h46;
     end;
   if s=h31 then
     begin
      MsgResult:=IntToStr(GetFeeDate);
      CommandID:=s;
      ResultValue:=h46;
     end;
   if s=hFD then PostMess(0,0,'','',pSvcType,Now,pContent,'');
   PostTranClient(2,pHandle,pHand,CommandID,'','',0,MsgResult,Now,ResultValue);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -