Flength := socket.ReceiveLength;
RecTxt := socket.ReceiveText;
我要得到RecTxt的值,然后根据RecTxt的值判断下面继续执行什么事件(如接收文件和接收信息2个事件)
同时我又要得到Flength的值,因为Flength是接收文件必须要得到的值.但现在是有了Flength := socket.ReceiveLength;之后,再加一句RecTxt := socket.ReceiveText;
Flength这句先写的话,那么这2句都能得到值.
但如果后面正好是继续执行接收文件事件,那么有后面这句就会错误,为什么?请教了----------------------------------------//这是接收文件的事件
sRecv:=copy(RecTxt,1,8);        //根据客户端发过来的信息的开始8个字符判断发来的是文件还是信息
if (sRecv='####1111') then
begin
  Flength := socket.ReceiveLength;  //这里又必须要得到 Flength的值
  getmem(resvbuff, Flength);
  try
    socket.ReceiveBuf(resvbuff^, Flength);
    strTemp := strpas(pchar(resvbuff));
    charTmp:=strTemp;
    strTemp := copy(strTemp, 1, 8);
    if strTemp = SF_QUERY then
    begin
    ...
-----------------------------------------//这是接收信息事件
else
begin
RxRichEdit1.Lines.Add(RecTxt);
...