Stomp C Client - frame end signature

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Stomp C Client - frame end signature

Martin Ronner
Hi.

I'm still a bit confused about the "\0\n" in the C client code.
Shouldn't it be "\n\0"? Or even just "\0"?

The stomp protocol specification (http://stomp.codehaus.org/Protocol)
defines the ^@ (null)
as the end of the frame. There's nothing mentioned about an additional
newline after.

As far as I understood its also handled inconsistently in other clients:
- "\n\0" in pearl (sub _transmit in Connection.pm):
      ....
      $string .= "\n";
      if ($body) {
          $string .= $body."\n";
      }
      $string .="\0";
      $socket->syswrite ($string, length($string));
      ....
- "\0\n" in C# (Transmit() in StompConnection.cs):
      ....
      socketWriter.WriteLine();
      socketWriter.WriteLine(body);
      socketWriter.WriteLine('\u0000');
      socketWriter.Flush();
      ....

Further, both clients include a newline between body and frame end. This
hasn't been defined by the spec. However, I do prefer that, but I
definitely don't like the newline after the null.

Regards,
Martin



Martin Ronner
Software Engineer
________________________________

Nexus Telecom AG
Wireless Network Systems
Muertschenstrasse 27
P.O. Box 1413
CH-8048 Zurich
Switzerland

Mobile: +41 76 355 6615
Main:   +41 44 355 6611
mailto:[hidden email]
http://www.nexustelecom.com

Reply | Threaded
Open this post in threaded view
|

Re: Stomp C Client - frame end signature

brianm
The newline after is not required but is allowed. Whitespace between  
frames is allowed and must be ignored.

It is done, in a lot of places, to make reading directly from the  
socket via netcat or telnet easier, but also to let naive clients  
(say a scripting implementation where full line-orientedness is just  
a bit easier to deal with (  socket.puts "\0" ).

The newline between the body and frame end is just a part of the  
message =)

-Brian

On Apr 24, 2006, at 7:14 AM, Martin Ronner wrote:

> Hi.
>
> I'm still a bit confused about the "\0\n" in the C client code.
> Shouldn't it be "\n\0"? Or even just "\0"?
>
> The stomp protocol specification (http://stomp.codehaus.org/Protocol)
> defines the ^@ (null)
> as the end of the frame. There's nothing mentioned about an additional
> newline after.
>
> As far as I understood its also handled inconsistently in other  
> clients:
> - "\n\0" in pearl (sub _transmit in Connection.pm):
>       ....
>       $string .= "\n";
>       if ($body) {
>           $string .= $body."\n";
>       }
>       $string .="\0";
>       $socket->syswrite ($string, length($string));
>       ....
> - "\0\n" in C# (Transmit() in StompConnection.cs):
>       ....
>       socketWriter.WriteLine();
>       socketWriter.WriteLine(body);
>       socketWriter.WriteLine('\u0000');
>       socketWriter.Flush();
>       ....
>
> Further, both clients include a newline between body and frame end.  
> This
> hasn't been defined by the spec. However, I do prefer that, but I
> definitely don't like the newline after the null.
>
> Regards,
> Martin
>
>
>
> Martin Ronner
> Software Engineer
> ________________________________
>
> Nexus Telecom AG
> Wireless Network Systems
> Muertschenstrasse 27
> P.O. Box 1413
> CH-8048 Zurich
> Switzerland
>
> Mobile: +41 76 355 6615
> Main:   +41 44 355 6611
> mailto:[hidden email]
> http://www.nexustelecom.com
>

Reply | Threaded
Open this post in threaded view
|

Re: Stomp C Client - frame end signature

chirino
Hi Brian,

Agreed.  Considering that we want to support telnet type clients and
line oriented scripting languages, wouldn't it be easier to require
the \0\n ??

I'd rather keep STOMP simple by having things behave 1 way.  Otherwise
things get more complicated as you now have to test for 2 forms of
frame terminators.

Regards,
Hiram

On 4/24/06, Brian McCallister <[hidden email]> wrote:

> The newline after is not required but is allowed. Whitespace between
> frames is allowed and must be ignored.
>
> It is done, in a lot of places, to make reading directly from the
> socket via netcat or telnet easier, but also to let naive clients
> (say a scripting implementation where full line-orientedness is just
> a bit easier to deal with (  socket.puts "\0" ).
>
> The newline between the body and frame end is just a part of the
> message =)
>
> -Brian
>
> On Apr 24, 2006, at 7:14 AM, Martin Ronner wrote:
>
> > Hi.
> >
> > I'm still a bit confused about the "\0\n" in the C client code.
> > Shouldn't it be "\n\0"? Or even just "\0"?
> >
> > The stomp protocol specification (http://stomp.codehaus.org/Protocol)
> > defines the ^@ (null)
> > as the end of the frame. There's nothing mentioned about an additional
> > newline after.
> >
> > As far as I understood its also handled inconsistently in other
> > clients:
> > - "\n\0" in pearl (sub _transmit in Connection.pm):
> >       ....
> >       $string .= "\n";
> >       if ($body) {
> >           $string .= $body."\n";
> >       }
> >       $string .="\0";
> >       $socket->syswrite ($string, length($string));
> >       ....
> > - "\0\n" in C# (Transmit() in StompConnection.cs):
> >       ....
> >       socketWriter.WriteLine();
> >       socketWriter.WriteLine(body);
> >       socketWriter.WriteLine('\u0000');
> >       socketWriter.Flush();
> >       ....
> >
> > Further, both clients include a newline between body and frame end.
> > This
> > hasn't been defined by the spec. However, I do prefer that, but I
> > definitely don't like the newline after the null.
> >
> > Regards,
> > Martin
> >
> >
> >
> > Martin Ronner
> > Software Engineer
> > ________________________________
> >
> > Nexus Telecom AG
> > Wireless Network Systems
> > Muertschenstrasse 27
> > P.O. Box 1413
> > CH-8048 Zurich
> > Switzerland
> >
> > Mobile: +41 76 355 6615
> > Main:   +41 44 355 6611
> > mailto:[hidden email]
> > http://www.nexustelecom.com
> >
>
>


--
Regards,
Hiram
Reply | Threaded
Open this post in threaded view
|

Re: Stomp C Client - frame end signature

chirino
On 4/26/06, Hiram Chirino <[hidden email]> wrote:
> Hi Brian,
>
> Agreed.  Considering that we want to support telnet type clients and
> line oriented scripting languages, wouldn't it be easier to require
> the \0\n ??
>
> I'd rather keep STOMP simple by having things behave 1 way.  Otherwise
> things get more complicated as you now have to test for 2 forms of
> frame terminators.

Let me clarify myself a bit.  I think \0 should remain the frame
terminator.  But I think \n should a required subsequent character.

>
> Regards,
> Hiram
>
> On 4/24/06, Brian McCallister <[hidden email]> wrote:
> > The newline after is not required but is allowed. Whitespace between
> > frames is allowed and must be ignored.
> >
> > It is done, in a lot of places, to make reading directly from the
> > socket via netcat or telnet easier, but also to let naive clients
> > (say a scripting implementation where full line-orientedness is just
> > a bit easier to deal with (  socket.puts "\0" ).
> >
> > The newline between the body and frame end is just a part of the
> > message =)
> >
> > -Brian
> >
> > On Apr 24, 2006, at 7:14 AM, Martin Ronner wrote:
> >
> > > Hi.
> > >
> > > I'm still a bit confused about the "\0\n" in the C client code.
> > > Shouldn't it be "\n\0"? Or even just "\0"?
> > >
> > > The stomp protocol specification (http://stomp.codehaus.org/Protocol)
> > > defines the ^@ (null)
> > > as the end of the frame. There's nothing mentioned about an additional
> > > newline after.
> > >
> > > As far as I understood its also handled inconsistently in other
> > > clients:
> > > - "\n\0" in pearl (sub _transmit in Connection.pm):
> > >       ....
> > >       $string .= "\n";
> > >       if ($body) {
> > >           $string .= $body."\n";
> > >       }
> > >       $string .="\0";
> > >       $socket->syswrite ($string, length($string));
> > >       ....
> > > - "\0\n" in C# (Transmit() in StompConnection.cs):
> > >       ....
> > >       socketWriter.WriteLine();
> > >       socketWriter.WriteLine(body);
> > >       socketWriter.WriteLine('\u0000');
> > >       socketWriter.Flush();
> > >       ....
> > >
> > > Further, both clients include a newline between body and frame end.
> > > This
> > > hasn't been defined by the spec. However, I do prefer that, but I
> > > definitely don't like the newline after the null.
> > >
> > > Regards,
> > > Martin
> > >
> > >
> > >
> > > Martin Ronner
> > > Software Engineer
> > > ________________________________
> > >
> > > Nexus Telecom AG
> > > Wireless Network Systems
> > > Muertschenstrasse 27
> > > P.O. Box 1413
> > > CH-8048 Zurich
> > > Switzerland
> > >
> > > Mobile: +41 76 355 6615
> > > Main:   +41 44 355 6611
> > > mailto:[hidden email]
> > > http://www.nexustelecom.com
> > >
> >
> >
>
>
> --
> Regards,
> Hiram
>


--
Regards,
Hiram