System.Net.Sockets.SocketException (0x80004005)

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

System.Net.Sockets.SocketException (0x80004005): Invalid arguments (v2.17 )

Sathyaraj
2020-04-15 05:26:28

Upgraded the SDK to the latest (v2.17 ) and when tapped on phone flight mode I get the following Exception instantly and disconnects with DisconnectCause.none

: Cannot send to: 92.223.82.24. Uptime: 25530 ms.   Local: 25.2.223.196:49380 Remote:  (not connected, not bound)  
: System.Net.Sockets.SocketException (0x80004005): Invalid arguments  
:   at System.Net.Sockets.Socket.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) [0x00016] in <162d614634844458a5a341a34ee2c013>:0  
:   at ExitGames.Client.Photon.SocketUdp.Send (System.Byte[] data, System.Int32 length) [0x00027] in <ecfe73d034e14d47aaf6dde8a90e224b>:0  
: UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)  
: UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])  
: UnityEngine.Logger:Log(LogType, Object)  
: UnityEngine.Debug:LogError(Object)  
: Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at G:\IJS\SkipBoGit\skipbogame\SkipBoGame\Assets\Photon\PhotonRealtime\Code\LoadBalancingClient.cs:2297)  
: ExitGames.Client.Photon.<>c__DisplayClass103_0:<EnqueueDebugReturn>b__0()  
: ExitGames.Client.Photon.EnetPeer:Dispatc

So I reverted back the SDK to 2.13 and it works normally without exception and disconnects after a few seconds later. Which is the normal behaviour in my opinion.

Please correct me if I missed something to add with the new SDK. any new line of code has to be added to make it behave like the old version?

Comments

Sathyaraj
2020-04-16 17:54:43

@JohnTube

JohnTube
2020-04-17 10:25:45

Hi @Sathyaraj,

What Unity version do you use?
Does this happen in the Unity Editor or in a build?
What is the target platform?
What is the scripting backend? mono version?

Any chance to have minimal repro steps?
Did you try to reproduce with demo scenes?

JohnTube
2020-04-23 11:11:31

Hi @Sathyaraj,

I have checked with @Tobias.
That exception is caught and logged but should not be re-thrown.
We did not log this in 2.13 or earlier.

The change made here is actually meant to speed up disconnection detection which is what happens when you enable flight mode.
So maybe we need to tweak things and trigger disconnection callback earlier with proper disconnection cause and skip logging this.

Tobias
2020-04-30 10:21:32

We don't log this as ERROR anymore and the status change SendError is handled in PUN 2.18.
Please update.

Sathyaraj
2020-04-30 11:59:50

Understood. loud and clear.

Sathyaraj
2020-04-30 12:27:20

But randomly I get strange issue like I get OnLeftRoom instead of OnDisconnected when flightmode button toggled instantly and say its a 2 players game when player 2 disconnected and reconnected and asks masterclient for the new state, player 1 instance responds with not masterclient.
Player 1 did not getOnMasterClientSwitched call
. These both cases are random.

Sathyaraj
2020-05-04 05:44:33

@Tobias

semonbright
2020-06-03 05:13:09

A SocketException is thrown by the Socket and Dns classes when an error occurs with the network. Most of the time these are connectivity issues due to different IP protocols (IPV4/IPV6) between the two server/computers trying to communicate or extra authentication rules setup on one of the computers for in/out connectivity. Ways to troubleshoot this SocketException are, check you have proper internet connection is there on your machine or not, and you are able to ping the remote server or not. Possible causes for the error:

You are using the wrong IP address.
You are using the wrong port.
Firewall blocking the connection.

Back to top