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

Anthony Ortiz anthonypaulo at gmail.com
Thu Mar 17 03:26:33 CST 2005


Damn Justin, don't you ever sleep??? :P

I don't think it was split up because I was flushing the output at the
correct stages. Just to give you an idea :

*** DID NOT WORK WITH EXODUS ***
// note : ft.out is regular output socket stream, ft.in is input
BufferedOutputStream bout = new BufferedOutputStream(ft.out);

// send version (5) and no-authentication (0) to client
bout.write(5);
bout.write(0);
bout.flush();
					
// read socks5 message from client (contains SHA1 host address and port 0)
JSocks5Message m = new JSocks5Message(ft.in);

// check SHA1 hash, make sure all is in order.
// ... <snip>
// looks good, so we proceed

// send response message (status = 0)  to client indicating that all
is good to go
m = new JSocks5Message(5, 0, 0, 3, ft.host, ft.port);

m.write(ft.out); <--- writing to regular socket stream rather than through bout
*************************************************

When I changed the last line to :

m.write(bout)

all worked well. Weeeeeeeeeeeird... but I'm not one to look a gift
horse in the mouth.

To track this sucker down I had to download exodus and all of the
necessary components (including Indy, Jedit Code Library, etc...) and
trace through, though I was unable to trace through the socket code
for some reason. After some experimenting with the type of data I was
sending and seeing the error message that popped back, I was finally
able to determine that the problem was with my code, and it turned out
to be what I just finished posting. During the process I discovered a
bug in the Indy socks library version 10 where it's shaving off a byte
in the host address of the request packet... I'll have to report it to
them. As for why it worked with Psi and not Exodus is still a mystery,
but I'm sure glad that my client's file xfer problems are over.

cul8r allig8rs!

Anthony

On Thu, 17 Mar 2005 00:34:48 -0800, Justin Karneges
<justin-keyword-jabber.093179 at affinix.com> wrote:
> Just to throw out a random guess here, but perhaps sending across the
> unbuffered stream caused the data to be split up, and Exodus was assuming
> that the response would be all in one piece?
> 
> Not that it's your software to fix, but it might be worth pursuing this with
> the Exodus guys just to be sure a bug isn't being glossed over.
> 
> -Justin
> 
> On Thursday 17 March 2005 12:25 am, Anthony Ortiz wrote:
> > 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.
> >
> > Anthony
> >
> > 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 0.9.0.39; 0.9.0.0 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
> >
> > _______________________________________________
> > jdev mailing list
> > jdev at jabber.org
> > http://mail.jabber.org/mailman/listinfo/jdev
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mail.jabber.org/mailman/listinfo/jdev
>



More information about the JDev mailing list