SendNetworkString()

Syntax

Result = SendNetworkString(Connection, String$ [, Format])
Description
Send a string to the specified client. This function can be used by both client and server applications.

Parameters

Connection The connection to send the string to. On the server side, 'Connection' is the client which should receive this data. On the client side, 'Connection' is returned by OpenNetworkConnection().
String$ The string to send.
Format (optional) The string format to use when sending the string. This can be one of the following values:
  #PB_Ascii  : sends the strings as ASCII
  #PB_UTF8   : sends the strings as UTF8 
  #PB_Unicode: send the strings as unicode
If this parameter is not specified, the string will be sent in UTF8 format if the program is compiled in unicode mode and in ASCII format otherwise.

Return value

Returns the number of bytes sent.

Remarks

SendNetworkString() provides a solution to quickly send strings. The string will be sent without the terminating null-character, and can be received using ReceiveNetworkData(), after NetworkServerEvent() / NetworkClientEvent() returned #PB_NetworkEvent_Data). In unicode mode the string is sent as UTF-8, which is processor independent (unlike UTF-16 which is tied to processor endianness). There is no ReceiveNetworkString() command.

See Also

SendNetworkData(), ReceiveNetworkData()

Supported OS

All

<- SendNetworkData() - Network Index - ServerID() ->