<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ffffff">
El dom, 06-07-2014 a las 19:44 +0200, Andreas Grapentin escribió:
<BLOCKQUOTE TYPE=CITE>
Hi again,<BR>
</BLOCKQUOTE>
<BR>
Hi Andreas,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Sorry for the delay. <BR>
</BLOCKQUOTE>
<BR>
I was about to say you the same, ;-) <BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
strlen on the message payload buffer returns 0.<BR>
</BLOCKQUOTE>
<BR>
So it's defined and it is an empty string....<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
I think my websockets setup is quite unusal, and I will try to clarify a bit.<BR>
<BR>
I have a server application witten in node.js, and connect a number of websocket clients written in various languages to that server. One of these clients is written in C and uses the nopoll library. The others are written in java, php, python and javascript, again node.js. No browsers involved.<BR>
<BR>
This is the point where we break up the client/server model, because the connected clients will now listen for messages from the server. The server implements a round-based simulation, and will send a message for each round to the clients, and wait for their replies, basically implementing a broadcast and barrier pattern.<BR>
<BR>
at some point during the simulation, the C client (and only the C client) fails because the messages it receives stop making sense, starting with an empty message followed by several messages marked as fragments.<BR>
The other clients do not show this behaviour, which makes me think the error must be somewhere within the library (or I use it wrong).<BR>
</BLOCKQUOTE>
<BR>
That's odd since we are using noPoll intensively and various long running environments...using really similar setups like yours :-?<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
I will try again with the latest version from the repository, and if it still persists I will try to find the source of the problem.<BR>
<BR>
If I find out anything interesting, I'll let you know.<BR>
</BLOCKQUOTE>
<BR>
Ok, let's see you can fix your issue with the latest SVN revision. If not, a tcpdump/wireshark trace should do to spot the problem...<BR>
<BR>
Let us to know any detail or progress so we can follow up the issue,<BR>
Best Regards,<BR>
<BLOCKQUOTE TYPE=CITE>
kind Regards,<BR>
Andreas<BR>
<BR>
P.S: please tell me if this mailing list is using bottom-posting instead of top-posting =)<BR>
</BLOCKQUOTE>
<BR>
;-) Use the most confortable for you Andreas, there is no problem...<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
On 06/29/2014 05:26 PM, Francis Brosnan Blázquez wrote:<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE TYPE=CITE>
On jue, 2014-06-26 at 18:00 +0200, Andreas Grapentin wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
Hi,<BR>
</BLOCKQUOTE>
<BR>
Hi there Andreas,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
first of all, thank you very much for giving the world a decent WebSockets library in C. That made my life so much easier!<BR>
</BLOCKQUOTE>
<BR>
;-) Thank you very much for your words. That means a lot to us! A twitter pat won't hurt @aspl_es :-)<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Unfortunately though, there seems to be a glitch where after a couple of seconds of continuous runtime a frame arrives at my program, where<BR>
<BR>
nopoll_msg_get_payload(msg); // returns an empty string<BR>
nopoll_msg_get_payload_size(msg); // returns 1<BR>
</BLOCKQUOTE>
<BR>
Interesting.... so calling to strlen over the result reported by nopoll_msg_get_payload reports 0 or 1?<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
in my callback.<BR>
<BR>
If I choose to silently ignore this event, then the following frames are corrupted, reporting invalid data.<BR>
</BLOCKQUOTE>
<BR>
Uhmn.... so something gets tangled there :-?<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
This usually happens only when my app is on very high traffic, and has run for about a minute.<BR>
<BR>
Can you help me find out what's going wrong, or point me in the right direction where to look?<BR>
</BLOCKQUOTE>
<BR>
Don't know... yet ;-). We have it working for several public available products and nothing similar has been reported...<BR>
...and one of them is very traffic intense (Core-Admin).<BR>
<BR>
You can try the following:<BR>
<BR>
1) In the case you are using a browser, try to upgrade it. WebSocket is a fairly young protocol. We have found<BR>
various issues with some browsers that got fixed after upgrading them.<BR>
<BR>
2) You can also have the latest noPoll version from the svn. It is stable and should be released soon and the next stable release:<BR>
<BR>
<A HREF="https://dolphin.aspl.es/svn/publico/nopoll//trunk/">https://dolphin.aspl.es/svn/publico/nopoll//trunk/</A><BR>
<BR>
3) You can also try running your server with logs enabled and send us log traces. For that you can<BR>
start your server with something like this (assuming you are running Linux/Unix version):<BR>
<BR>
>> NOPOLL_DEBUG=1 ./your-server-app<BR>
<BR>
...and if you are running on windows, you can use a combination of nopoll_log_enable and nopoll_log_set_handler<BR>
to capture the log.<BR>
<BR>
4) If it doesn't work, please, let us know which browser/client side software are you using. If would be really great<BR>
to have a working example that reproduces the problem...<BR>
<BR>
In any case, please let us know your progress to find out if this is something specific to noPoll or maybe a browser/client side...<BR>
<BR>
Best Regards,<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Thank you, and kind Regards,<BR>
Andreas<BR>
<BR>
<BR>
Below is my main function, and my callback:<BR>
<BR>
void<BR>
botframe_callback (noPollCtx *ctx, noPollConn *conn, noPollMsg *msg, noPollPtr *user_data)<BR>
{<BR>
if (nopoll_msg_is_fragment(msg))<BR>
{<BR>
printf("oh, I got a fragment!\n");<BR>
return;<BR>
}<BR>
<BR>
char *message = nopoll_msg_get_payload(msg);<BR>
unsigned int length = nopoll_msg_get_payload_size(msg);<BR>
<BR>
if (length <= 1)<BR>
{<BR>
printf("that's not a message!\n");<BR>
return;<BR>
}<BR>
<BR>
// after this point, there is a lot of json parsing, and data management<BR>
// somewhere in the middle of it, I send a response:<BR>
<BR>
nopoll_conn_send_text (conn, str, strlen(str));<BR>
<BR>
// and then there is some more stuff, and resource releasing code<BR>
}<BR>
<BR>
<BR>
int<BR>
main (void)<BR>
{<BR>
noPollCtx *ctx = nopoll_ctx_new();<BR>
if (!ctx)<BR>
{<BR>
perror("unable to create websocket context");<BR>
exit(1);<BR>
}<BR>
<BR>
nopoll_ctx_set_on_msg(ctx, (noPollOnMessageHandler)&botframe_callback, NULL);<BR>
<BR>
noPollConn *conn = nopoll_conn_new(ctx, "localhost", "8080", NULL, NULL, NULL, NULL);<BR>
if (!nopoll_conn_is_ok(conn))<BR>
{<BR>
perror("unable to connect to cow server");<BR>
exit(1);<BR>
}<BR>
<BR>
nopoll_loop_wait(ctx, 0);<BR>
<BR>
return 0;<BR>
}
<PRE>
_______________________________________________
noPoll mailing list
<A HREF="mailto:noPoll@lists.aspl.es">noPoll@lists.aspl.es</A>
<A HREF="http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll">http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BLOCKQUOTE>
<BR>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
--
Francis Brosnan Blázquez <<A HREF="mailto:francis.brosnan@aspl.es">francis.brosnan@aspl.es</A>>
ASPL
91 134 14 22 - 91 134 14 45 - 91 116 07 57
AVISO LEGAL
Este mensaje se dirige exclusivamente a su destinatario. Los datos
incluidos en el presente correo son confidenciales y sometidos a secreto
profesional, se prohíbe divulgarlos, en virtud de las leyes vigentes. Si
usted no lo es y lo ha recibido por error o tiene conocimiento del mismo
por cualquier motivo, le rogamos que nos lo comunique por este medio y
proceda a destruirlo o borrarlo.
En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de
diciembre, de Protección de Datos de Carácter Personal, le informamos de
que sus datos de carácter personal, recogidos de fuentes accesibles al
público o datos que usted nos ha facilitado previamente, proceden de
bases de datos propiedad de Advanced Software Production Line, S.L.
(ASPL). No obstante, usted puede ejercitar sus derechos de acceso,
rectificación, cancelación y oposición dispuestos en la mencionada Ley
Orgánica, notificándolo por escrito a:
ASPL - Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de
Henares (Madrid).
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>