The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by mascott]

I am having a problem with the server accepting more than one command. Ther
first <stream:stream ... > packet I send via telnet works. Once I try to send
another packet </stream:stream> the QueueThread does not put another packet
out of the queue. Am I doing something wrong?

Marlin
import-bot (20211) [Avatar] Offline
#2
Re: Problem with source code
[Originally posted by iainshigeoka]

Closing the stream tag closes the stream. The server stops listening to the
connection when that occurs. You need to put all your Jabber packets inside
(as sub-elements) of the <stream> tag.

-iain
import-bot (20211) [Avatar] Offline
#3
Re: Problem with source code
[Originally posted by mascott]

> Closing the stream tag closes the stream. The server stops listening to the
> connection when that occurs. You need to put all your Jabber packets inside
> (as sub-elements) of the <stream> tag.
>
> -iain
Iain,

Thank you for the response. I think I phrased my question wrong. Once I send
the <stream:stream ....> packet I get my connection established. If I send a
<message> packet I get no response. If I initiate another telnet session I
get connected, but when I send any packets through that telnet session
<stream:stream> I get no response. I put a logging statement in the
QueueThread to see when I am pulling a packet and it only happens once, on the
initial <stream:stream....> call. Any ideas?


public void run(){

System.out.println("Waiting for packet");
for( Packet packet = packetQueue.pull();
packet != null;
packet = packetQueue.pull())

{
System.out.println("pulling packet");
try {
if (packet.getFrom() == null){
packet.setFrom(packet.getSession().getJID().toString());
}
String matchString = packet.getElement();

synchronized(packetListeners){
Iterator iter = packetListeners.keySet().iterator();
while (iter.hasNext()){
PacketListener listener = (PacketListener)iter.next();
String listenerString = (String)packetListeners.get(listener);
if (listenerString.equals(matchString) || listenerString.length()
== 0){
listener.notify(packet);
return;
} // if
} // while
} // sync
} catch (Exception ex){
Log.error("QueueThread: ", ex); // Soldier on - no matter what
}
} // for
} // run()
import-bot (20211) [Avatar] Offline
#4
Re: Problem with source code
[Originally posted by iainshigeoka]

> Iain,
>
> Thank you for the response. I think I phrased my question wrong. Once I send
> the <stream:stream ....> packet I get my connection established. If I send a
> <message> packet I get no response. If I initiate another telnet session I
> get connected, but when I send any packets through that telnet session
> <stream:stream> I get no response. I put a logging statement in the
> QueueThread to see when I am pulling a packet and it only happens once, on the
> initial <stream:stream....> call. Any ideas?

Two possibilites off the top of my head. First, telnet may not be sending the
data along. Make sure you're hitting enter/return after each packet so telnet
transmits the data (if you're using software, make sure you're flushing the
socket). Second, there is a possibility that the XML parser is getting 'stuck'
since it really isn't designed to do streaming XML parsing. To unstick Xerces
(the XML parser being used), just send a few extra space characters followed
by another enter.

One other possibility is that you're using a different version of Xerces than
I used when developing the software. This can be the case if you have other
Xerces libraries on the classpath ahead of the one used with the server. Make
sure you've got the right version of Xerces or streaming XML parsing will be
broken (my workaround won't work). I don't think this is the case though since
you were able to compile and run the server.

If these don't work, let me know and we'll keep trying to figure it out.

-iain