UNET LLAPI How to reconnect a client after disconnect event

I think this is supposed to be automatic in UNET, but I just can’t seem to make this happen. I’m running a game via a LAN with specified IPs between a single server and client. I’m using the transport layer/LLAPI to pass data streams back and forth, and I’m using two different sockets (with two different ports/IPs for each socket - 1 for each direction of data). There are times when either client of server may drop out and then return. I don’t need to save game state, but I do need to be able to reestablish the connection.
If I restart the server or client and do nothing, the data flow TO the rejoining player will not reestablish (data From the rejoining player – data from the player calling the Connect() event after rejoining – has no problems restarting). When I attempt to connect the socket TO the rejoining player again, the socket reconnects with a socketID of -1 and resultant errors. If I attempt to establish an entirely new socket with a new port number, the socketID and connectionID appear to be establishing a proper connection (I even register a NetworkEventType.ConnectEvent), but no data flowing.
I’m using QOS unreliable; I’ve tried shutting down the NetworkTransport.Send events as soon as they return an error (due to no receiver), and then using NetworkTransport.RemoveHost, so there shouldn’t be any accumulation of data in any buffers or message queues. I would explicitly dump the queue if I knew how (I would thing RemoveHost does this anyway).
The data does reestablish in one direction when the data Sender shuts down and then restarts a connection, so this shouldn’t be too hard to figure out, but it seems beyond me. Any ideas???

Hi, @rich_seabirdsi .
Here what i did. It is about reconnecting to unet llapi server, not about restoring data of reconecting.

first, you need “connected” flag:

public bool connected = false;

Then, you create an Init and a Coroutine of you clinet/server connection:

        void Start()
        {
            NetworkTransport.Init();
            ConnectionConfig config = new ConnectionConfig();
            myReiliableChannelId = config.AddChannel(QosType.Reliable);
            myUnreliableChannelId = config.AddChannel(QosType.Unreliable);
            HostTopology topology = new HostTopology(config, 1);
            hostId = NetworkTransport.AddHost(topology, 20122);

            byte error;
            myConnectionId = NetworkTransport.Connect(hostId, serverIp, serverPort, 0, out error);
            Debug.Log("Server connection result: " +error.ToString());

            initialized = true;

            StartCoroutine(Server());
        }

      IEnumerator Server()  
{

            int recHostId;
            int connectionId;
            int channelId;
            byte[] recBuffer = new byte[1024];
            int bufferSize = 1024;
            int dataSize;
            byte error;
            while (true)
            {
                recBuffer = new byte[1024];

                if (sendQuery.Count > 0 && connected) //<-- WE SENDING DATA FROM PACKETS BUFFER ONLY IF WE CONNECTED. Otherwise we just gethering packets.
                {
                    foreach (byte[] sendData in sendQuery)
                    {
                        Debug.Log("Sending data");
                        NetworkTransport.Send(hostId, myConnectionId, myReiliableChannelId, sendData, sendData.Length, out error);
                    }
                    sendQuery = new List<byte[]>();
                }

                NetworkEventType recData = NetworkTransport.Receive(out recHostId, out connectionId, out channelId, recBuffer, bufferSize, out dataSize, out error);
                switch (recData)
                {
                    case NetworkEventType.Nothing:
                        break;
                    case NetworkEventType.DataEvent:
                      //your data processing
                    case NetworkEventType.ConnectEvent:
                        Debug.Log("Connect event");

                        if (myConnectionId == connectionId)
                        {
                            Debug.Log("We connected to server");
                            connected = true;
                            break;
                        }
                        else
                        {
                            Debug.Log("Someone has connected to us! O_o");
                            break;
                        }
                    case NetworkEventType.DisconnectEvent:
                        Debug.Log("Disconnect event");

                        if (myConnectionId == connectionId)
                        {
                            Debug.Log("We can't connect to server! :(");
                            connected = false;
                            myConnectionId = NetworkTransport.Connect(hostId, serverIp, serverPort, 0, out error); // <--- HERE WE HAVE OUR RECONNECT
                            break;
                        }
                        else
                        {
                            Debug.Log("Someone has disconnected from us! O_o");
                            break;
                        }

                        break;
                }
                yield return new WaitForEndOfFrame();
            }
        }

So we catching a disconnect event and trying to connect in it.