Bug report // How do I do it then! ;[

I felt it was a little overkill, to submit a bugreport, but I love Unity, and bugs have to be mentioned, maybe it’s just my computer crashing… The case; I am getting an RPC call from a client, and I am trying to extract the IP address from this, using the following method on the server, recieving the RPC:

@RPC
function VersionCreate(Version : int, Info : NetworkMessageInfo)
{
//The sender of this RPC was:
Debug.Log(Network.connections[(Info.sender)].ipAddress);
}

Now, this way is a bit of jury-rigged, that I wanted to test. Info.sender returns the ID number of the client, not the actual IP, and Network.connections[ID].ipAdress returns the IP of a given ID, however, when combined in this way it explodes in an instant crash, at least for me. I tried on two machines, several times. First time I ever see a crash in Unity.

  • Finally; I still need to resolve this, how do I then extract the IP of a recieved RPC call, without having to manually add it as a parameter of the send RPC, didn’t think that would be required, given the wonders of NetworkMessageInfo. Any ideas? Smart people, work your magic!

Thank you in advance.

Hi!

Your error is because in Network.connections on clients, there is only the server and the client, not other client, nor is the ID coherant over the call. So on clients your ID is always 1 and server always 0. It would be better if you just sent the IP along with the RPC. You can get it from: Network.player.ip or something ike that :slight_smile:

Hope this helps,
Benproductions1