1。在indy中,使用Tidtcpserver控件的ReadBuffer的时候,必须指定回收字节长度,长度超过回收字节的话线程会阻塞,请问如何在不知道回收字节长度的情况下使得回收正常工作。有没有其他办法得到所要回收字节的长度呢??问题很急。
2。在indy中,Socket发生阻塞大家怎么处理,这个时候所有程序好像都死了一样啊。如果有代码得话能否贴出来让小弟SeeSee(比如用超时怎么解决,有没有代码看一下)。整个公司就我一个人开发windows环境下的程序。真的好郁闷。
2。在indy中,Socket发生阻塞大家怎么处理,这个时候所有程序好像都死了一样啊。如果有代码得话能否贴出来让小弟SeeSee(比如用超时怎么解决,有没有代码看一下)。整个公司就我一个人开发windows环境下的程序。真的好郁闷。
别人在什么环境下开发?
请问ReadTimeout设置得代码写在哪里。是写在LockList之后吗????
自己UP一下
TIdPeerThread(LIst.Items[List.Count-1]).Connection.ReadTimeOut := 5000;
TIdPeerThread(List.Items[List.Count-1]).Connection.WriteBuffer(buffcommand,bufflength);
{将所接收到的16进制命令存放到byte数组}
TIdPeerThread(List.Items[List.Count-1]).Connection.ReadBuffer(buffResult,ResultLength);
IdServer.Threads.UnlockList;
这样写对吗
有这么一个函数原形,查一下,就是一直接受,直到断开连接,看看D6自带的 Demo 好象是PictureServer什么的
规定一个消息的格式,例如:
type
TMsgBlock = record
SenderName : string[100];//发送者
Msg : string[1024];//消息
end;
///////////////// Client ////////////////
var
MB : TMsgBlock;
begin
...
IdTcpClient.SendBuffer(MB);
end;/////////////// Server.Execute ///////////////
var
MB : TMsgBlock
begin
...
AThread.Connection.ReadBuffer(MB,SizeOf(MB));
...
end;
type
ClientWareRecord = Packed Record
ClientInteger : Integer;
ClientState : TDataState;
ClientDNS,
ClientComType : String[20];
ClientUser,
ClientName,
ClientPath,
ServerPath : String[250];
end; .....procedure TMainFrm.IdTCPServerExecute(AThread: TIdPeerThread);
var
MyRec : ClientWareRecord;
begin
AThread.connection.ReadBuffer(MyRec,SizeOf(MyRec));
if MyRec.ClientComType = MP_NEWCOUNT then
begin
try
MyRec.ServerPath := StrSavePath;
UpdateNewWarecount(MyRec.ClientUser,MyRec.ClientName);
finally
AThread.connection.WriteBuffer(MyRec,SizeOf(MyRec),true);
end;
end;
end;