Skip to content

[Host] May I ask how Netly can change the UDP receiver in real-time in Unity?I use server.Open(<host>) changing IP does not work. #27

Discussion options

You must be logged in to vote

#25 (reply in thread)

server.Open
can't change host when connection is opened, because connection is already opened. use server.Close to netly stop bind old ip and port, after use server.OnClose to receive close connection notice, and on server.OnClose open connection again using new Host instance and all will running perfectly.

using Netly;
using Netly.Core;
using System;
using UnityEngine;

public class UdpServerExample : MonoBehaviour
{
    // unity side
    public string ip = "127.0.0.1";
    public int port = 12000;
    private KeyCode reconnectKeyCode = KeyCode.Enter;

    private Host host = null;
    private bool useNewHost = false;
    private UdpServer server = new UdpServer(false)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@1101728133
Comment options

@alec1o
Comment options

Answer selected by 1101728133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants