Unity LLAPI Connection Problem

I’m working on a multiplayer game which uses the LLAPI. I’m able to establish a connection between 2 projects, one 2D and one 3D and send data from the 3D one to the 2D one. However, I’m unable to do so the other way around. I didn’t want to use a host/client architecture and instead wanted to establish a peer to peer connection.

I know this is being caused by my client connection script which is identical in both projects. I can’t get my head around why it doesn’t work though since I can establish the connection as data can be send one way but not the other? It gives the Error:WrongConnection

    int connectionId;
    int channelId;
    int hostId;
    int port = 12345;
    public bool connected = false;
    private MessageHandler messageHandler;

    public void Connect () {

        //Initialize Network Transport Class
        NetworkTransport.Init ();

        //Define Parameters of Connection
        ConnectionConfig config = new ConnectionConfig();
        channelId = config.AddChannel (QosType.Reliable);

        //Create Topology
        HostTopology topology = new HostTopology(config, 10);

        //Create Host
        hostId = NetworkTransport.AddHost(topology, port);

        Debug.Log ("Host ID: " + hostId);

        byte error;
        connectionId = NetworkTransport.Connect (hostId, "192.168.1.235", port, 0, out error);

        messageHandler = GetComponent<MessageHandler> ();
    }

    void Update () {
        int outHostId;
        int outConnectionId;
        int outChannelId;
        byte[] buffer = new byte[1024];
        int bufferSize = 1024;
        int receiveSize;
        byte error;

        NetworkEventType evnt = NetworkTransport.Receive(out outHostId, out outConnectionId, out outChannelId, buffer, bufferSize, out receiveSize, out error);
        switch (evnt)
        {
        case NetworkEventType.ConnectEvent:
            if (outHostId == hostId &&
                outConnectionId == connectionId &&
                (NetworkError)error == NetworkError.Ok)
            {
                Debug.Log("Connected");
                connected = true;
            }
            break;
        case NetworkEventType.DisconnectEvent:
            if (outHostId == hostId &&
                outConnectionId == connectionId)
            {
                Debug.Log("Connected, error:" + error.ToString());
            }
            break;
        case NetworkEventType.DataEvent:
//            if (!connected)
//                break;
//            Debug.Log (FromByteArray (buffer));
            Message m = FromByteArray (buffer);
            messageHandler.HandleMessage (m);
            break;
        }
    }

Turns out the port I was trying to access was being used by another program on one of the machines which was preventing access to it. Code is fine. I’ll leave this post up in case someone else runs into a similar issue.