|
From: bosnio <bo...@ne...> - 2002-05-06 19:45:27
|
Hi, it's me again
First of all and once again, thanks to Samuel Bayes, you have solved my =
problem, i had it for a long time and i had tried almost everything.
Now i have two simple problems which i don't know if are bugs, or my =
problems.
The first is when i call the server with no args it should exit and =
print the usage line and it doesn't... And i have three arguments. It =
prints if a use only one agrument in all other cases except if i don't =
give any args.
This is not a big problem i made a test to the value of argc.
The next and more challenging one is, when i send a message to the hub =
and this message should produce an error, like an operation that does,t =
exist, i receive the same message i sent, and i wanted to receive the =
error message which i see in the hub pane.
Once again i send the interaction of the hub, and the server:
=20
------------------------HUB
Got new message from provider for UI (id 2)
M-M dialogue for provider for UI (id 2)
----------------[ 1]----------------------
{c Echo.k
:frase "O meu recebe isto"
:session_id "Default"
:tidx 1 }
----------------------------------------
(ERROR:
------ System Warning/Error ------
)
{c system_error
:server_unavailable 1
:operation "k"
:server_name "Echo"
:session_id "Default"
:tidx 2 }
(ERROR: ------------------------------------
)
[Destroying token 2]
tokens: 1 (0)
done with token 1 --> returning to owner UI@<remote>:-1
[Destroying token 1]
--------------------------------SERVER
GalIO_CommDispatchFrame: sending new message:
{c UI
:signatures ( )
:properties {c server_properties }
:extra_service_types ( )
:protocol_version 1 }
GalIO_CommDispatchFrame: got reply:
{c UI
:signatures ( )
:properties {c server_properties }
:extra_service_types ( )
:protocol_version 1 }
GalIO_CommDispatchFrame: sending new message:
{c Echo.k
:frase "O meu recebe isto"
:hub_opaque_data {c admin_info
:reply_requested 1
:server_tidx 1 } }
GalIO_CommDispatchFrame: got reply:
{c Echo.k
:frase "O meu recebe isto"
:session_id "Default"
:hub_opaque_data {c admin_info
:tidx 1
:session_id "Default"
:server_tidx 1 } }
----------------------
The frame in Red was the one i wanted to receive.
I will now present the source code that i am using
=20
char* sendMessageToHub(char* recvline, int argc, char* argv[], char* =
oas[])
{
=20
GalIO_ServerStruct *server;
GalIO_CommStruct *new_comm;
GalSS_Environment *env;
int hubport;
char* hubaddress;
Gal_Frame request, reply;
char* sendline[MAXLINE]; =20
int i =3D MAXLINE;
GalIO_MsgType t;
memset(sendline,'\0',MAXLINE);
=20
//Testar se a string e uma frame be formada
request =3D Gal_ReadFrameFromString(recvline);
GalUtil_OAExtract(argc, argv, oas, "-hubport", GAL_OA_INT, &hubport); =
GalUtil_OAExtract(argc, argv, oas, "-hubaddress", GAL_OA_STRING, =
&hubaddress);
=20
server =3D GalSS_CmdlineSetupServer(argc, argv);
if(!server){
GalUtil_Fatal("Failed to set up server!\n!");
}
if ((new_comm =3D GalIO_ContactHub(hubaddress, hubport, server, =
NULL,0)) =3D=3D NULL)
{
sprintf(sendline, "{c error :descrition \"Can't contact hub at port: =
%d , host: %s}", hubport, hubaddress);
printf(sendline);
return(sendline);
}
while(1){
int res =3D GalIO_VerificationHandler(new_comm);
if(res =3D=3D -1) {
GalUtil_Fatal("Failed to confirm connection!\n");
}else if (res =3D=3D 1) {
break;
}
}
env =3D GalSS_EnvCreate(new_comm);
GalSS_EnvLock(env);
reply =3D GalSS_EnvDispatchFrame(env, request, &t);
=20
/* if(!reply){
=20
} =20
*/
switch(t){
case GAL_REPLY_MSG_TYPE:
printf("\n Mesnagem ok\n");
break;
case GAL_ERROR_MSG_TYPE:
printf("\n Granda azar erro\n");
break;
=20
}
=20
=20
GalSS_EnvUnlock(env);
=20
=20
Gal_PrFrame(reply);
Gal_PrFrameToString(reply,sendline, &i);=20
Gal_FreeFrame(reply);
Gal_FreeFrame(request);
GalIO_DestroyCommStruct(new_comm);
GalIO_DestroyServerStruct(server);
return(sendline);
}
I am switching the return message type just for debug, because my server =
isn't supposed to do any processing it just passes the message to the =
webclient even if it is an error message. But the message i am receiving =
appear as a normal reply message and it should be an error one as we can =
see in the hub..
Once again thanks for the spared time
Jo=E3o Gra=E7a=20
|