Home > Back-end >  TTcpServer controls write multithreaded problem???
TTcpServer controls write multithreaded problem???

Time:09-20

I written in TTcpServer controls from a TcpServer service program, in realizing the OnAccept event, don't know is feasible, after my test, multiple client connection to upload files, out of the timeout now like, using multithreading is not should not appear this kind of problem, a great god, please help me to look at, TTcpServer controls do multithreading services, can you like me to write the code in the OnAccept event??????? I don't understand this control, I think I'm a little confused, please great god how to give directions, thank you!!!!!!

Procedure TMYTcpServer. PD_OnNewAccept (Sender: TObject; VClientSocket: TCustomIpClient);
Var
MTcpSeverThr: TSeverReceiveThread;
The begin
MTcpSeverThr:=TSeverReceiveThread. Create (vClientSocket);//create the receiving thread and hang
MTcpSeverThr. RunMsg:=PD_ThrRunMsg;//set the thread running schedule information back to the main window of a method using the Synchronize (thread () call)
MTcpSeverThr. ToMsg:=OnMessage;//thread to return to the main window of a common information method (using the Synchronize threads () call)
MTcpSeverThr. Start;//start a thread
While vClientSocket. Connect the do//what the client Socket is connected,
The begin
Forms. Application. ProcessMessages;
If Not Assigned (mTcpSeverThr) then the Exit;
end;
end;
  • Related