Problems with messages from socket. - Motif
This is a discussion on Problems with messages from socket. - Motif ; When three or more messages are sent we can only read the first two
messages from the socket. The rest of the messages arrives first when
new messages are sent to the socket, all old messages are then read
but ...
-
Problems with messages from socket.
When three or more messages are sent we can only read the first two
messages from the socket. The rest of the messages arrives first when
new messages are sent to the socket, all old messages are then read
but only the two first of the new messages are read.
We have used xtAppAddInput to register the callback function and
xtAppMainLoop to wait for new messages.
Any ideas what causes our problem?
Thanks
Susanne
-
Re: Problems with messages from socket.
susanne.olenson@tietoenator.com (Susanne) wrote in
news:24ba9bb0.0310210617.5f4bb576@posting.google.c om:
> When three or more messages are sent we can only read the first two
> messages from the socket. The rest of the messages arrives first when
> new messages are sent to the socket, all old messages are then read
> but only the two first of the new messages are read.
Sounds like a bug in your program. Motif does not read your socket, your
program does. Your program decides how much it wants to read.
Ken Lee, http://www.rahul.net/kenton/
-
Re: Problems with messages from socket.
Susanne wrote:
> When three or more messages are sent we can only read the first two
> messages from the socket. The rest of the messages arrives first when
> new messages are sent to the socket,
Sounds like you are using TCP sockets and expect one send to result in
one recv. That is not so: you need to implement the separation between
packets yourself (e.g. by starting each message with a byte count) and
repeat recv, buffering the bytes, until you know you have the whole message.
> all old messages are then read
> but only the two first of the new messages are read.
>
> We have used xtAppAddInput to register the callback function and
> xtAppMainLoop to wait for new messages.
>
> Any ideas what causes our problem?
>
> Thanks
> Susanne
--
Michel Bardiaux
Peaktime Belgium S.A. Bd. du Souverain, 191 B-1160 Bruxelles
Tel : +32 2 790.29.41
-
Re: Problems with messages from socket.
Michel Bardiaux wrote in message news:<3F9566AA.4020705@peaktime.be>...
> Susanne wrote:
> > When three or more messages are sent we can only read the first two
> > messages from the socket. The rest of the messages arrives first when
> > new messages are sent to the socket,
>
> Sounds like you are using TCP sockets and expect one send to result in
> one recv. That is not so: you need to implement the separation between
> packets yourself (e.g. by starting each message with a byte count) and
> repeat recv, buffering the bytes, until you know you have the whole message.
>
The messages are complete, the problem is that they do not arrive as
expected.
I have now found a bug in a program we are using for reading messages,
so the problem was not related to Motif as I first thought. Thanks for
your response anyway.
> > all old messages are then read
> > but only the two first of the new messages are read.
> >
> > We have used xtAppAddInput to register the callback function and
> > xtAppMainLoop to wait for new messages.
> >
> > Any ideas what causes our problem?
> >
> > Thanks
> > Susanne