[ANet] Using a hostname to connect to

Posted By: SchokoKeks

[ANet] Using a hostname to connect to - 10/08/10 23:57

Hi all,

I've tried to use a hostname like "mypc.no-ip.com" to connect to my anet server. When using the IP that is behind that adress, it connects fine.
When I try to use the hostname acknex freezes instantly and crashes with the following info (in german):

Code:
Problemsignatur:
  Problemereignisname:	BEX
  Anwendungsname:	acknex.exe
  Anwendungsversion:	0.0.0.0
  Anwendungszeitstempel:	4b2a3e3e
  Fehlermodulname:	MSVCR90.dll
  Fehlermodulversion:	9.0.30729.4926
  Fehlermodulzeitstempel:	4a1743c1
  Ausnahmeoffset:	000369de
  Ausnahmecode:	c0000417
  Ausnahmedaten:	00000000
  Betriebsystemversion:	6.1.7600.2.0.0.256.48
  Gebietsschema-ID:	1031
  Zusatzinformation 1:	1546
  Zusatzinformation 2:	15467be466987c95823a957a6a74a0b3
  Zusatzinformation 3:	ab21
  Zusatzinformation 4:	ab21d1340cccbedb55fa7d4f575a334a



Is there a way to use PRAGMA_API to resolve the host to an IP i can then connect to? I've never worked with the windows API. Any chance to get this included directly into ANet?

Thanks,
SchokoKeks
Posted By: Dark_samurai

Re: [ANet] Using a hostname to connect to - 10/09/10 16:08

Hmmm... I'm not sure about that. I guess you would have to use DNS to resolve the hostname into an IP. But I don't know how difficult this would be to implement.

I think this would be a useful feature. I will take a look into that.
Posted By: Dark_samurai

Re: [ANet] Using a hostname to connect to - 10/16/10 09:16

I just tried it with my public server and it works fine. Are you sure that it's not caused by your code?

I used this testapplication:

Code:
#include <acknex.h>
#include "anet.h"
#include "default.c"

void main()
{
	level_load("");
	wait(3);
	
	enet_init();
	
	while(1)
	{
		if(key_1)
		{
			enet_init_server(2300,4,"");
			while(key_1) wait(1);
		}
		if(key_2)
		{
			enet_init_client("mail.aauer.com",2300,"");
			while(key_2) wait(1);
		}
		wait(1);
	}
}



I used [F11] to open the debug panel and checked if I get a ClientID. Even if ANet can't resolve the name, it shouldn't crash but throw a disconnected event.

Please test this out. It's possible that this is a bug of ANet.
Posted By: WretchedSid

Re: [ANet] Using a hostname to connect to - 10/16/10 09:24

I can also confirm that Enet (and thus also Anet) is able to handle hostnames instead of just IP addresses.
Posted By: SchokoKeks

Re: [ANet] Using a hostname to connect to - 10/16/10 17:54

Dark_samurai, I've used your testapplication and it still crashes to client on connection, just a second after i'm trying to connect. There seems to be no timeout or similar.

I only changed the adress to connect to. Mine is a bit longer, its 20 characters long, could that be of any problem? I'm using no-ip.com and it works for other games and stuff.

I'm using 3DGS 7.86.2 and ANet 1.3.2.0.
Posted By: Dark_samurai

Re: [ANet] Using a hostname to connect to - 10/17/10 10:56

Thanks for the report!

Yes you're right. Because an IP can't be longer than 15 signs, the string was limited to 15 signs. I removed this limit. Now it should work. I've sent you a beta version. Please try it out and tell me if it's working now.
Posted By: SchokoKeks

Re: [ANet] Using a hostname to connect to - 10/17/10 16:37

Thanks for the fast fix, it works now.
There is a new bug in the password system now, I've send you an email about it.
Posted By: Dark_samurai

Re: [ANet] Using a hostname to connect to - 10/19/10 14:50

The password bug is also fixed now.

I think I will release the current beta version after another few days of beta testing.
Posted By: Germanunkol

Re: [ANet] Using a hostname to connect to - 10/19/10 14:59

Ah, maybe this is the bug I just sent you an email about? If it's already fixed - great! Would you be able to send me the new version? We want to distribute a demo of the game tomorrow and I'd not like to have to disable the password system...
© 2024 lite-C Forums