[jdev] Re: File xfer gone wrong? [SOLVED]

Anthony Ortiz anthonypaulo at gmail.com
Thu Mar 17 02:25:44 CST 2005

Okay, I figured out the problem.... it seems that in Java you can't
use an underlying stream when you're already using one of its
subclasses. In this instance, I created a buffered stream writer on my
outgoing socket stream and used it to do the socks handshake. After
the handshaking was done I needed to send the last reply packet
signifying everything was okay, but I did this using the regular
socket stream. It was choking on this part for some reason. When I
switched it to continue using the buffered output stream all worked
fine. I guess the morale of the story is that you can't use a stream
if it's already in use in on of your sublcassed stream writers. It
still doesn't answer why this worked with Psi and not with Exodus
though... strange.

Thanks for all your help.


On Wed, 9 Mar 2005 17:39:13 -0500, Anthony Ortiz <anthonypaulo at gmail.com> wrote:
> Hello everyone!
> I posted a message on the exodus newsgroup a while back but I think
> it's dead as I haven't seen any activity in weeks. Maybe someone has
> been thought this before or can spot the obvious and point me in the
> right direction, so I'm reposting most of it here.
> Thanks!!
> Anthony
> === repost from exodus newsgroup ===
> I've written a simple java applet that implements the Jabber protocol in very
> much the same way yahoo chat works. Right now things are going smoothly, I can
> log in, do rostering, chatting, and bytestream file transfers. I have been
> testing so far against the PSI client, and I am able to transfer files back and
> forth no problem. However, I seem to be having a problem with the Exodus client.
> I am able to receive a file from an Exodous client just fine (though I had to
> use the latest development build; resulted in a corrupted
> file), but for some reason I can't seem to send a file to Exodus, it gives me
> the error "Exodus was unable to connect to any file transfer proxies or the
> sender." This is what happens :
> 1) I do the usual stream initiation stuff
> 2) I create a server socket on host:port
> 3) I send the iq containing the streamhost stanza with the host:port
> 4) I accept the connection on the serversocket
> At this point the Exodus client is sending me a SOCKS5 version
> identifier/method selection message, stating that it
> supports "no authentication"
> 5) I send 2 bytes in response, the first byte being the version (5) and the
> second being "no authentication" (0).
> At this point the Exodus client is sending me a socks5 request message
> containing :
> version 5
> cmd 1
> type 3
> host = SHA1 hash
> port 0
> So far so good!
> 6) hash matches great, so I send the Exodus client a reply message with
> status = 0 meaning we're good to go
> It is at this point that I believe I have nothing left to do but wait for an
> iq response from the exodus client, but instead it immediately pops up an
> error message stating that it was unable to connect. How can that be when
> everything seemed to be going so well?? Is Exodus expecting something else?
> Or maybe I should be setting the other fields in my reply besides setting the
> status field to 0?? I tried filling in the reply message fields with :
> version : 5
> reply (status) : 0
> reserved : 0
> type = 3
> addr = host
> port = port
> and this doesn't work either. What am I doing wrong?? What's weird is that I
> can transfer files both ways against a PSI client, and PSI and Exodus work
> fine against each other as well, but it's only when I try to send a file to
> Exodus that I have this problem. Heeeeeeeeelp!!
> Thank you for your time!! :)
> Anthony

More information about the JDev mailing list