docs.unity.cn
    Show / Hide Table of Contents

    Enum NetworkEvent.Type

    Types of network events that can be returned by PopEvent(out NetworkConnection, out DataStreamReader).

    Namespace: Unity.Networking.Transport
    Syntax
    public enum Type : short

    Fields

    Name Description Value
    Empty

    No event. Returned when there are no more events to pop.


    0
    Data

    A message was received on the connection. The contents of the message can be read from the DataStreamReader that was returned along with the event. Furthermore, the pipeline on which the message was received will also be returned (for the variants of PopEvent that return it).


    1
    Connect

    Connection has been successfully established. From this point on it's okay to send data on the connection. Returned after calling Connect(NetworkEndpoint) when the connection was successful. Note that servers do not get this event (new connections are notified through the Accept() call).


    2
    Disconnect

    Connection has been closed, or has failed to be established. The reason for the disconnection can be read as a single byte off the DataStreamReader obtained along with the event. That single byte will represent a value from the DisconnectReason enum.


    3
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Thursday, June 1, 2023