2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
#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:
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
OP
Senior Member
|
OP
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
Okay, I tried it your way, it still doesn't work. The disconnect function:
function server_restart()
{
enet_disconnect_client(MY_CLIENTID, "restart");
}
The client event:
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
Serious User
|
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
Serious User
|
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
OP
Senior Member
|
OP
Senior Member
Joined: May 2009
Posts: 445
Peine, Germany
|
Sorry, I've been in holidays. It's working now! Big thanks, motivating me.
Last edited by Razoron; 10/20/10 12:13.
|
|
|
|