[jdev] Implementing db:result with JSO

Matthew A. Miller linuxwolf at outer-planes.net
Mon Mar 29 09:30:33 CST 2004


First, the caveat:  My efforts are focused on client- and 
component-level development, not server-level.  The furthest I've gone 
with accepting connections is for components that accept the connection 
from the server (rather than initiating the connections to the server), 
and for special-purpose c2s environments (e.g. no other servers involved).

However, I have not experienced anything like this for client- or 
component-level connections.  Which StreamSource are you using?  If it's 
the ChannelStreamSource, the underlying cannel should automatically 
flush its output as soon as its written (see the Sun's docs on "new I/O" 
for more details).  If it's the SocketStreamSource (which i admittedly 
do not use much at all), I've noticed an explicit flush was missing, but 
this should have impacted all connections (which, surprisingly, it hasn't).

At this point, I would first ensure that JSO is really writing out.  
This is most-easily done via nc (aka netcat).  Right now, it sounds to 
me like it's more an issue with jabberd2 than JSO.


-  LW

PS:  There is a dedicated mailing list for JSO.  You can find out more 
about it from http://jabberstudio.org/cgi-bin/mailman/listinfo/jso-devel.

PPS:  The "not really flushed" IOStreamSource is now updated in CVS.

Daniel Tietze wrote:

> Hi.
>
> The problem indeed seems to be fixed in the current version.
> But I'm encountering another strange problem. I implemented
> a "db:result" packet, following the docs. The thing appears
> to send itself OK, at least that's what my Logger tells me:
>
> [LOGGER]  sent: <db:result xmlns='jabber:server' 
> from='athen.go4teams.com'
> to='belfast.go4teams.com'>danielduesentrieb</db:result>
>
> On the Jabber server (jabberd2), this package is not
> received/processed until I kill my server. I get the "sent"
> output on my own server right away, but only after I kill my
> server with CTRL-C (closing all connections) the "jabberd -D"
> output shows that it has received this packet (debug from io.c:189).
>
> I have found no way to flush the underlying JSO stream implementation
> to ensure that my packet is being sent out.
>
> I'm attaching my JSO extension class to the bottom of this message.
>
> Here's how I'm sending it:
> ---------------------------
> try
> {
>     DialbackResultPacket dbr = new
> DialbackResultPacket(JSOImplementation.getInstance().getDataFactory());
>     dbr.setDialbackText("danielduesentrieb");
>     dbr.setTo(new JID("belfast.go4teams.com"));
>     dbr.setFrom(new JID("athen.go4teams.com"));
>     // Send the Dialback result packet
>     connection.send(dbr);
> }
> catch (Exception ex)
> {
>     ex.printStackTrace();
> }
> ---------------------------
>
> Any help greatly appreciated, as usual.
>
>   Daniel
>
> --[ 8< SNIP for Dialback Packet implementation ] -------
>
> public interface DialbackResult
> {
>     public static final NSI NAME = new NSI("db:result", "jabber:server");
>
>     void setDialbackText(String text);
>
>     String getDialbackText();
>
>
>
> }
>
>
> public class DialbackResultPacket
>         extends BasicPacketNode
>         implements DialbackResult
> {
>     StreamDataFactory fact;
>
>     public DialbackResultPacket(StreamDataFactory sdf)
>     {
>         super(sdf, NAME);
>         fact = sdf;
>     }
>
>     public DialbackResultPacket(org.jabberstudio.jso.StreamElement
> streamElement, BasicPacketNode basicPacketNode)
>     {
>         super(streamElement, basicPacketNode);
>     }
>
>
>     public org.jabberstudio.jso.StreamObject
> copy(org.jabberstudio.jso.StreamElement streamElement)
>     {
>         return new DialbackResultPacket(streamElement, this);
>     }
>
>     public String getDialbackText()
>     {
>         return null;
>     }
>
>     public void setDialbackText(String text)
>     {
>         this.add(new TextNode(fact, text));
>     }
> }
>
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> https://jabberstudio.org/mailman/listinfo/jdev




More information about the JDev mailing list