Delphi: Buffers and Indy-TCP
Language: Delphi Compiler: Delphi 2005 --------- Hey all I've made a program using TServerSocket and TClientSocket. I would like to change this program to use Indy's TCP Client/Server (due to the multi-threading within the indy-components). This has though caused some problems for me as i've used buffers (records) to send most of the data. My problems are: ---- 1) How does these commands look using IdTCPClient? ClientSocket.Socket.ReceiveBuf(Buffer, sizeOf(Buffer)); ClientSocket.Socket.SendBuf(Buffer, sizeOf(Buffer)); ---- 2) How does these commands look using IdTCPServer? ServerSocket.Socket.SendBuf(Buffer, sizeOf(Buffer)); ServerSocket.Socket.ReceiveBuf(Buffer, sizeOf(Buffer)); ---- 3) And how is this done with IdTCPServer? procedure TMainForm.SendMessageToAll(Buffer: TUser); var i: Integer; begin for i:=0 to ChatServerSocket.Socket.ActiveConnections-1 do begin ChatServerSocket.Socket.Connections.SendBuf(Buffer, sizeOf(Buffer)); end; end; ---- The variable "buffer" is of this type in all questions: TUser = Record Command: String[50]; Username: String[50]; Password: String[50]; end; Examples how to use buffers with the TCP Indy-components would be very welcome. So far I haven't been able to locate much info about it on the net. Thanks in advance, Søren
Søren RiisDenmark
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement