Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, 7th_zorro, 1 invisible), 890 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: [ANet] Disconnect message [Re: Dark_samurai] #343224
10/04/10 15:37
10/04/10 15:37
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Code:
#include <acknex.h>
#include <anet.h>

void main()
{
	level_load("");
	wait(3);
	enet_init();
	enet_clset_event(EVENT_DISCONNECTED, "ev_cl_disconnected");
	while(1)
	{
		if(key_1)
		{
			enet_init_server(2300, 4, "");
			while(key_1) wait(1);
		}
		if(key_2)
		{
			enet_init_client("localhost", 2300, "");
			while(key_2) wait(1);
		}
		if(key_d)
		{
			enet_disconnect_client(0, "Disconnected");
			while(key_d) wait(1);
		}
		wait(1);
	}
}

void ev_cl_disconnected(var sender, STRING* msg)
{
	STRING* test_str = str_create("#100");
	str_cpy(test_str, msg);
	error(test_str);
}



The code above works just fine for me.
If I do it this way:

Code:
void ev_cl_disconnected(var sender, STRING* msg)
{
	STRING* test_str = str_create(msg);
	error(test_str);
}



Then there is no zero termination at the end of the string => random characters after the original text.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANet] Disconnect message [Re: Dark_samurai] #343230
10/04/10 16:11
10/04/10 16:11
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline OP
Senior Member
Razoron  Offline OP
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Okay, I tried it your way, it still doesn't work.
The disconnect function:
Code:
function server_restart()
{
	enet_disconnect_client(MY_CLIENTID, "restart");
}


The client event:
Code:
void client_disconnected(var sender, STRING* msg)
{
	STRING* savemsg = str_create("#100"); // Save the message
	str_cpy(savemsg, msg);
	error(savemsg);
}


The only thing that is different is that I use a server - client.

Re: [ANet] Disconnect message [Re: Razoron] #343603
10/07/10 19:51
10/07/10 19:51
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Ah ok. I will take a look at this.

Thanks for the report.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANet] Disconnect message [Re: Dark_samurai] #343726
10/09/10 16:00
10/09/10 16:00
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline
Serious User
Dark_samurai  Offline
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
I think I solved the problem. I've sent you the new ANet version that should fix the problem (check your PM's). Please try it and tell me if it's working now.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: [ANet] Disconnect message [Re: Dark_samurai] #344753
10/20/10 12:12
10/20/10 12:12
Joined: May 2009
Posts: 445
Peine, Germany
Razoron Offline OP
Senior Member
Razoron  Offline OP
Senior Member

Joined: May 2009
Posts: 445
Peine, Germany
Sorry, I've been in holidays.
It's working now! Big thanks, motivating me. laugh

Last edited by Razoron; 10/20/10 12:13.
Page 2 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1