LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

NetworkTransport.Receive

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function Receive(out hostId: int, out connectionId: int, out channelId: int, buffer: byte[], bufferSize: int, out receivedSize: int, out error: byte): Networking.NetworkEventType;
public static Networking.NetworkEventType Receive(out int hostId, out int connectionId, out int channelId, byte[] buffer, int bufferSize, out int receivedSize, out byte error);

Parameters

hostId Id of udp socket where event happened.
connectionId Connection id for event.
channelId Channel id for data event.
buffer Prepared incoming buffer.
bufferSize Prepared buffer size.
receivedSize Actually received length.
error Possible error.

Description

Delivered different network events to user. kConnectionEvent will notify about new connection established, kDisconnectEvent will report about disconnection happened, kDataEvent will report about new information delivered. Use must represent buffer for delivered data.