Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Only tries to connect once #318

Closed
Closed
@roa-nyx

Description

@roa-nyx

Version Number and Operating System(s):

Version 26 from the asset store (Mar 20, 2019), Windows 10 1903

Expected behavior:

Attempt to connect to server 10 times with 3 second delays between attempts. If server is unreachable trigger connectAttemptFailed event on UDPClient.

Actual behavior:

//Snippet from UDPClient.Connect
				Task.Queue(() =>
				{
					do
					{
						// Send the accept headers to the server to validate
						Client.Send(connectHeader, connectHeader.Length, Server.IPEndPointHandle);
						Thread.Sleep(3000);
					} while (!headerExchanged && IsBound && ++connectCounter < CONNECT_TRIES);

					if (connectCounter >= CONNECT_TRIES)
					{
						if (connectAttemptFailed != null)
							connectAttemptFailed(this);
					}
				});

Attempts to connect once, a SocketException occurs in UDPClient.ReadNetwork, which triggers Disconnect(true) which ultimately results in IsBound on the client to be set to false, which pre-empts any further connection attempts.

Additionally because the connectCounter never increments, the connectAttemptFailed is never triggered.

Steps to reproduce:

			comm = new UDPClient();
			comm.connectAttemptFailed += clientConnectFailed;
			comm.serverAccepted += clientConnected;
			comm.bindFailure += clientBindFailure;
			comm.Connect("127.0.0.1", 9789);

Make sure to create your own clientConnectFailed, clientConnected and/or clientBindFailure functions to use this test code.

#180 seems to indicate this is in some way related to IP parsing? But I'm not seeing how. In my case I'm trying to connect to 127.0.0.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions