###Function###
TCPRecv

###Description###
Receives data from a connected socket.

###Syntax###
TCPRecv ( mainsocket, maxlen [, flag] )


###Parameters###
@@ParamTable@@
mainsocket
	The connected socket identifier (SocketID) as returned by a <a href="TCPAccept.htm">TCPAccept</a> or a <a href="TCPConnect.htm">TCPConnect</a> function.
maxlen
	max # of characters to receive.
flag
	[optional] Forces the function to return binary data if set to 1 (default is 0, and will auto detect between binary/string).
@@End@@

###ReturnValue###
@@ReturnTable@@
Success:	Returns binary/string sent by the connected socket.
Failure:	Returns "" and set @error
@error:	-1 Socket error
	windows API WSAGetError return value (see <a href="http://msdn.microsoft.com/en-us/library/ms740668.aspx">MSDN</a>).
@@End@@


###Remarks###
For backwards compatibility reasons this function will try to return strings by default. If null (0x00) characters are received then the return value will be a binary type.
To force the function to always return binary data (the most sensible option) then use the "flag" parameter set to 1.


###Related###
BinaryLen, BinaryMid, TCPStartup, TCPAccept, TCPConnect, TCPTimeout (Option)


###Example###
@@IncludeExample@@
