Connected but not Joined to Session ... problem

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.
Posted By: EpsiloN

Re: Connected but not Joined to Session ... problem - 09/08/13 09:37

I just ran into the same problem. However , I'm not sending anything to the server or evaluating any strings for now.
All I do is

Code:
function client_connect_to(STRING* ip_string,STRING* session_id)
{
	session_connect(session_id, ip_string);
	while(dplay_status < 2) wait(1); // wait until the session is opened or joined



DPlay Status is stuck on 1 on client , server says 8.
The code for the server is only session_open , wait 5 sec. level_load("empty.wmb") ...
I just ran into a post, the problem was solved by reinstalling, but I might try it later.

PS.: Just to inform you that this problem occurs even without the evaluation of the strings that you mention.
*EDIT*
I just found out why it was happening in my project.
I used #ifdef server | #else | #endif and #define server for server app and //#define server in client (started in "Run current script")
After removing those #defines I used if(connection == 1 || 3) else{} and started using "Test Run". Everything works fine, dplay_status goes up to 6 on client with entity created and rotated by server.
© 2024 lite-C Forums