Can't connect exception, custom connection settings, buddies

I have a few issues which I need some help with.

1. when I try to connect to photon, but the computer does not have an internet connection, nothing happens (which is fine), but I also get an exception "Connect() failed: System.Net.Sockets.SocketException: No such host is known". Can I get rid of it somehow?

2. can I set some other connectusing string besides version? I would like to separate my rooms also by map and game mode, not just game version. Or is there another way to do this?

3. I am trying to achieve a very user friendly networking, which would automatically pick a room with other players when you click multiplayer and join (which is already working alright). However, I would also like to be able to connect to a room where my buddy (other player) is. Could you point me in a direction how to achieve this? I don't want to use some third party service for logging in and etc.

Thank you very much for any ideas


  • Hi,

    1. Are you sure about that exception? Photon should catch it and log error message only. Can you provide exception stack?

    2. Look at "customRoomProperties" and "propsToListInLobby" parameters of PhotonNetwork.CreateRoom operation. Some clients can specify map and game mode with these options while creating room, while others will get list of rooms with properties set when connecting to the lobby.

    3. Probably PhotonNetwork.FindFriends is what you are looking for.
  • 1) well it's a "red" error in unity. I am sorry I am not familiar with exception stack. What should I do to get that for you?

    here's the full message at least:

    Connect() failed: System.Net.Sockets.SocketException: No such host is known
    at System.Net.Dns.hostent_to_IPHostEntry (System.String h_name, System.String[] h_aliases, System.String[] h_addrlist) [0x00000] in <filename unknown>:0
    at System.Net.Dns.GetHostByName (System.String hostName) [0x00000] in <filename unknown>:0
    at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0
    at ExitGames.Client.Photon.IPhotonSocket.GetIpAddress (System.String serverIp) [0x00000] in <filename unknown>:0
    at ExitGames.Client.Photon.SocketUdp.DnsAndConnect () [0x00000] in <filename unknown>:0

    2) thanks, already implemented :)

    3) I guess this would be better with some type of external authentication, right? like a website or sth.
  • 1. Sometimes PUN can throw red errors which are not critical. Application can safely continue after these errors (but it may pause in editor if 'Error Pause' checked in console)
    3. To make use of FindFriends, you need to set unique username via PhotonNetwork.playerName or via PhotonNetwork.AuthValues before connect.
    Second option is the way to engage external authentication. See ... entication
  • 1. ok ignoring this one

    3. so here is what I did

    - photonnetwork.playername = "Koul";
    - then I connect to lobby and join some room

    void Start()
    void CheckForFriends()
    	PhotonNetwork.playerName = "test";
    void OnJoinedLobby()
    	string&#91;&#93; pls = new string&#91;1&#93;;
    	pls&#91;0&#93; = "Koul";
    	foreach(FriendInfo fi in PhotonNetwork.Friends)

    the client 2 reports false instead of true. What am I doing wrong?
  • Processing FindFriends request takes some time. So you can't check results right after method call.
    Do it in OnUpdatedFriendList message handler
  • Thanks. Everything works correctly now :)