Re: ServerSocket - OnClientRead event.
Posted by WAllison on May 10, 2002 at 22:09:31:
In Reply to: ServerSocket - OnClientRead event. posted by Bill Adams on April 15, 2002 at 23:51:20:
: I've been reading up on some examples of how to receive data from the connection. Now, here's a snippet from one of the examples i'm looking at:
: Could someone explain what's going on here? I'm slightly confuse as to what's happening and i'm fairly new to Delphi so a simple explanation would be great.
//Determine the amount of info to read over the socket connection. MsgLen := Socket.ReceiveLength; //Allocate MsgLen bytes for Buf SetLength( Buf, MsgLen ); //Transfer the data into buf+1 - returning the actual amount transfered; LenReceived := Socket.ReceiveBuf( Buf, MsgLen); //Make sure string is right length = copy itself to itself but use the actual Length Recieved - copies from index 1 to Length. Buf := Copy( Buf, 1, LenReceived );