Old RPC to UNet (Server to single client)

I have a client project and a server project, and I currently am using the old RPC method. I’m trying to convert this code to UNet, but I’m not sure how to begin since the code is different on client and server. I do not want database information client-side. Can anyone give me some pointers on how to achieve this with UNet?

The client starts the RPC with RPCClientAuthenticateGet with their username and password.

Client

[RPC]
public void RPCClientAuthenticateGet ( string u, string p ) {
    //Invokes on server.
}

[RPC]
public void RPCClientAuthenticateSet ( bool success ) {
    if (success) {
        Debug.Log("Received successful authentication.");
    }
    else {
        Debug.Log("Received unsuccessful authentication.");
    }
}

Server

[RPC]
public void RPCClientAuthenticateGet ( string u, string p, NetworkMessageInfo info ) {
    int _clientID = 0;
    _clientID = Database.SimpleSelectInt("SELECT TOP 1 clientID FROM Clients WHERE clientEmail = '" + u + "' AND clientPass = '" + p + "' AND NOT clientAccess = '0'");
    ClientCache.ClientCacheAdd(info.sender, _clientID, 0, 0, null);
    if (_clientID != 0) {
        Debug.Log("[client.auth] Success " + info.sender.ipAddress + " " + u + ".");
        //Client found in database, reply back to client with a successful response.
        GameObjects.GameManagerNetworkView.RPC("RPCClientAuthenticateSet", info.sender, true);
    }
    else {
        Debug.Log("[client.auth] Failure " + info.sender.ipAddress + " " + u + ".", 1);
        //Client was not found in database, reply back to client with a negative response.
        GameObjects.GameManagerNetworkView.RPC("RPCClientAuthenticateSet", info.sender, false);
    }
}

[RPC]
public void RPCClientAuthenticateSet ( bool success ) {
    //Invokes on client.
}

I was able to remedy this by attaching this script to my player gameObject with the networkIdentity.
Client and Server

[RPC] to [Command]
public void RPCClientAuthenticateGet(...){...} to public void CmdClientAuthenticate(...){...}

[RPC] to [ClientRpc]
public void RPCClientAuthenticateSet(...){...} to private void RpcClientAuthenticate(...){...}

With the old networking, the server only had one component to manage all RPC’s no matter how many players were connected… So this way seems over redundant, but it works.

Nevermind… My server is sending to all players that are in range of the client that is trying to authenticate. Meaning upon a successful login, it will tell neighboring players that they entered a proper username and password even when sitting idle.

Problem fixed or not? Just wondering.

Client and Server

using UnityEngine.Networking;

public static class AppMsgType {

    #region MsgID Enums
    public enum ClientIDs {
        ClientAuthQuery,
        ClientAuthResult
    }
    #endregion

    #region MsgID Extentions
    public static short MsgID ( this ClientIDs id ) { return GetMsgID(id); }
    #endregion

    #region MsgID Functions
    public static short GetMsgID ( ClientIDs id ) {
        int _id = (int) id + 300;
        return (short) _id;
    }
    #endregion

    public class ClientAuthQuery : MessageBase {
        public string username;
        public string password;
    }

    public class ClientAuthResult : MessageBase {
        public bool result;
    }
}

Client

YourNetworkClient.RegisterHandler(AppMsgType.ClientIDs.ClientAuthResult.MsgID(), OnClientAuthResult);

    /// <summary>
    /// Client only.
    /// </summary>
    public void StartClientAuth ( ) {
        //Create outgoing message.
        AppMsgType.ClientAuthQuery outMsg = new AppMsgType.ClientAuthQuery();
        outMsg.username = "TestUsername";
        outMsg.password = "TestPassword";
        Debug.Log("outMsg: " + outMsg.username + " , " + outMsg.password);

        localClient.Send(AppMsgType.ClientIDs.ClientAuthQuery.MsgID(), outMsg);
    }

    /// <summary>
    /// Client only
    /// </summary>
    /// <param name="netMsg"></param>
    public void OnClientAuthResult( NetworkMessage netMsg ) {
        AppMsgType.ClientAuthResult inMsg = netMsg.ReadMessage<AppMsgType.ClientAuthResult>();
        Debug.Log("inMsg: " + inMsg.result);
    }

Server

NetworkServer.RegisterHandler(AppMsgType.ClientIDs.ClientAuthQuery.MsgID(), OnClientAuthQuery);

    /// <summary>
    /// Server only
    /// </summary>
    /// <param name="netMsg"></param>
    public void OnClientAuthQuery ( NetworkMessage netMsg ) {
        //Open incoming message.
        AppMsgType.ClientAuthQuery inMsg = netMsg.ReadMessage<AppMsgType.ClientAuthQuery>();
        Debug.Log("inMsg: " + inMsg.username + " , " + inMsg.password);

        //Create outgoing message.
        AppMsgType.ClientAuthResult outMsg = new AppMsgType.ClientAuthResult();
        outMsg.result = true;
        Debug.Log("outMsg: " + outMsg.result);

        //Send message back to client / player.
        NetworkServer.SendToClient(netMsg.conn.connectionId, AppMsgType.ClientIDs.ClientAuthResult.MsgID(), outMsg);
    }

I made a msgID function to make it easier to maintain with enums. Hope this helps.