Posted By: NeoJT
Connected but not Joined to Session ... problem - 04/23/13 07:11
Hi... (and sorry for my english)
Before 2 days i had a problem and finally last night i solved
but i have no idea how and why...
I have 3 files.
1) 1 for server. "server.c"
2) 1 for client. "client.c"
3) and 1 for global funtion and variables "fandv.c"
The 1st and the 2nd file use the 3d file...
This was my problem.
the server has created normal...
but the client has connected ONLY and NOT JOINED to session
I have create and others server-clients in 3dgamestudio - lite-c BUT NERE I HAD THIS
PROBLEM...
the 1st file "server" and the 2nd file "client" have one function call which is inside the 3d file...
f_start_server_client(void* l_str);
or
f_start_server_client(STRING* l_str);
Inside this function :
1) compare the l_str whith the string that give it the server or client
2) if it is "server" run server
3) if it is "client" run client...
I was try to run server... ok
I was try to run client... ok
in my last version of that program i was changed the string "server" to "server_login".
then next try to run the server was... ok
but
next try to run the client was ... connected with the session but not joined. dplay_status = 1;
( Thanks to God i have backup of my old files i finally i fix it. )
I was try to run older backup... and running
I was try to run the new... problem
the older backup have difference in variables... functions... etc.
but yesterday i change one backup to new and i found this :
ALL MY CODE IS OK... BUT
When i call from server the function f_start_server_client
I MUST GIVE TO PARAMETER A STRING WITH THE SAME LENGTH TO STRING FOR CLIENT.
example:
i had call f_start_server_client("Server") ... the parameter length = 6.
and
i had call f_start_server_client("Client") ... the parameter length = 6.
when i had make that change "server" to "server_login" i had the problem
because :
f_start_server_client("Server_Login") ... the parameter length = 12.
f_start_server_client("Client") ... the parameter length = 6.
BUT I DONT KNOW WHY WHY WHY WHY WHY WHY WHY WHY WHY ???
and why i wrote that... ?
1st) if can anyone help me to understand the solution and
2nd) if anyone have the same problem to think that solution if he has done the same mistake...
my solution was to convert the string "Server_Login" to int _server_login_int = 1;
and "Client" to int _client_int = 2;
and the type parameters in function i have changed
------------------------------------------------
from
function f_start_server_client(STRING* l_str)
---------------- >>
to
function f_start_server_client(int l_int)
------------------------------------------------
and inside the function :
----------------
from :
if (str_cmp(l_str, "Server_Login") )
{
...
}
if (str_cmp(l_str, "Client") )
{
...
}
---------------- >>
to :
switch (l_int)
{
case (_server_login_int):
{
...
}
break;
case (_client_int):
{
...
}
break;
}
------------------------------------------------
IF CAN ANYONE TELLS ME WHY I CANT SEND STRING WITH DIFFEREND LENGTH... PLEASE...
and thanks to GOD "SERVER" and "CLIENT" have the same length 6 and for that reason i
hadnot problem in my olders programs before...
THX you all (and sorry for my english).
Best Regards.
Dimitris.
Before 2 days i had a problem and finally last night i solved
but i have no idea how and why...
I have 3 files.
1) 1 for server. "server.c"
2) 1 for client. "client.c"
3) and 1 for global funtion and variables "fandv.c"
The 1st and the 2nd file use the 3d file...
This was my problem.
the server has created normal...
but the client has connected ONLY and NOT JOINED to session
I have create and others server-clients in 3dgamestudio - lite-c BUT NERE I HAD THIS
PROBLEM...
the 1st file "server" and the 2nd file "client" have one function call which is inside the 3d file...
f_start_server_client(void* l_str);
or
f_start_server_client(STRING* l_str);
Inside this function :
1) compare the l_str whith the string that give it the server or client
2) if it is "server" run server
3) if it is "client" run client...
I was try to run server... ok
I was try to run client... ok
in my last version of that program i was changed the string "server" to "server_login".
then next try to run the server was... ok
but
next try to run the client was ... connected with the session but not joined. dplay_status = 1;
( Thanks to God i have backup of my old files i finally i fix it. )
I was try to run older backup... and running
I was try to run the new... problem
the older backup have difference in variables... functions... etc.
but yesterday i change one backup to new and i found this :
ALL MY CODE IS OK... BUT
When i call from server the function f_start_server_client
I MUST GIVE TO PARAMETER A STRING WITH THE SAME LENGTH TO STRING FOR CLIENT.
example:
i had call f_start_server_client("Server") ... the parameter length = 6.
and
i had call f_start_server_client("Client") ... the parameter length = 6.
when i had make that change "server" to "server_login" i had the problem
because :
f_start_server_client("Server_Login") ... the parameter length = 12.
f_start_server_client("Client") ... the parameter length = 6.
BUT I DONT KNOW WHY WHY WHY WHY WHY WHY WHY WHY WHY ???
and why i wrote that... ?
1st) if can anyone help me to understand the solution and
2nd) if anyone have the same problem to think that solution if he has done the same mistake...
my solution was to convert the string "Server_Login" to int _server_login_int = 1;
and "Client" to int _client_int = 2;
and the type parameters in function i have changed
------------------------------------------------
from
function f_start_server_client(STRING* l_str)
---------------- >>
to
function f_start_server_client(int l_int)
------------------------------------------------
and inside the function :
----------------
from :
if (str_cmp(l_str, "Server_Login") )
{
...
}
if (str_cmp(l_str, "Client") )
{
...
}
---------------- >>
to :
switch (l_int)
{
case (_server_login_int):
{
...
}
break;
case (_client_int):
{
...
}
break;
}
------------------------------------------------
IF CAN ANYONE TELLS ME WHY I CANT SEND STRING WITH DIFFEREND LENGTH... PLEASE...
and thanks to GOD "SERVER" and "CLIENT" have the same length 6 and for that reason i
hadnot problem in my olders programs before...
THX you all (and sorry for my english).
Best Regards.
Dimitris.