Show / Hide Table of Contents

# Interface INetEventListener

###### Namespace: LiteNetLib

###### Assembly: LiteNetLib.dll

##### Syntax

    public interface INetEventListener

### Methods

#### OnConnectionRequest(ConnectionRequest)

On peer connection requested

##### Declaration

    void OnConnectionRequest(ConnectionRequest request)

##### Parameters

Type | Name | Description
--- | --- | ---
ConnectionRequest | request | Request information (EndPoint, internal id, additional data)

#### OnNetworkError(IPEndPoint, SocketError)

Network error (on send or receive)

##### Declaration

    void OnNetworkError(IPEndPoint endPoint, SocketError socketError)

##### Parameters

Type | Name | Description
--- | --- | ---
IPEndPoint | endPoint | From endPoint (can be null)
SocketError | socketError | Socket error

#### OnNetworkLatencyUpdate(NetPeer, int)

Latency information updated

##### Declaration

    void OnNetworkLatencyUpdate(NetPeer peer, int latency)

##### Parameters

Type | Name | Description
--- | --- | ---
NetPeer | peer | Peer with updated latency
int | latency | latency value in milliseconds

#### OnNetworkReceive(NetPeer, NetPacketReader, byte, DeliveryMethod)

Received some data

##### Declaration

    void OnNetworkReceive(NetPeer peer, NetPacketReader reader, byte channelNumber, DeliveryMethod deliveryMethod)

##### Parameters

Type | Name | Description
--- | --- | ---
NetPeer | peer | From peer
NetPacketReader | reader | DataReader containing all received data
byte | channelNumber | Number of channel at which packet arrived
DeliveryMethod | deliveryMethod | Type of received packet

#### OnNetworkReceiveUnconnected(IPEndPoint, NetPacketReader, UnconnectedMessageType)

Received unconnected message

##### Declaration

    void OnNetworkReceiveUnconnected(IPEndPoint remoteEndPoint, NetPacketReader reader, UnconnectedMessageType messageType)

##### Parameters

Type | Name | Description
--- | --- | ---
IPEndPoint | remoteEndPoint | From address (IP and Port)
NetPacketReader | reader | Message data
UnconnectedMessageType | messageType | Message type (simple, discovery request or response)

#### OnPeerConnected(NetPeer)

New remote peer connected to host, or client connected to remote host

##### Declaration

    void OnPeerConnected(NetPeer peer)

##### Parameters

Type | Name | Description
--- | --- | ---
NetPeer | peer | Connected peer object

#### OnPeerDisconnected(NetPeer, DisconnectInfo)

Peer disconnected

##### Declaration

    void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
NetPeer | peer | disconnected peer
DisconnectInfo | disconnectInfo | additional info about reason, errorCode or data received with disconnect message