How to detect if X ip is a client or a server

Hey, i realise there are the functions. Network.Isclient and Network.IsServer, however they dont match my needs. Im trying to compare an IP address with the servers IP address, if(Network.player.ipAddress != TheOtherIpaddress) doesnt work as when the server uses this function, the var TheOtherIpaddress, is empty, but doesnt register as null.

Not sure if this is making half the sense it should.

Note, The server works as a server/client system, its not standalone.

IP monitor helps you to detect the IP address. It monitors your network devices, servers, and applications.

I think you just need to create an RPC function in a persistent gameobject in your scene (the one called connectionGUI in the official multiplayer project). That rpc function needs to "return" the IP, so quite simply at a point (possibly OnNetworkLevelLoad or a similar one-shot system function) you make a call.


In the same script there's the following

string serveripaddress = ""; //this will hold the server ip address after the call

[RPC] //this will -only- be called against the server
void getserveripaddressfunction(NetworkMessageInfo info) {
  networkView.RPC("sendbackserveripaddress", info.sender, Network.player.ipAddress);

      //the client will receive this call asynchronously, after the server receives
[RPC] //the request with the above function
void sendbackserveripaddress(string serveripaddressparam) {
  serveripaddress = serveripaddressparam;

so that your "serveripaddress" variable is conveniently loaded once you need it, after 'OnNetworkLevelLoad' has executed.

Welcome to the horrible world of networking