[jcifs] How to create multiple TCP connections for the same server in a thread !!

Cittarasu Thirunavukkarasu cittarasu at gmail.com
Thu Feb 26 11:17:54 GMT 2009


Hi Michael,

Thanks for the info, Can you please elaborate, that is where to sabotage the
jcifs code so that jcifs/smb/SmbSession.matches()  always returns false ?

Here is the my script which will create TCP Flows in a thread, but right now
all threads are created using the same TCP tuples !!

My Code
=======
public void run() {

            SmbFileInputStream in = null;
            try {
                in = new SmbFileInputStream( "url" );
            } catch (SmbException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (MalformedURLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
               byte[] b = new byte[10];
               int n, tot = 0;
               try {
                while(( n = in.read( b )) > 0 ) {
                    System.out.write( b, 0, n );
                    tot += n;
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
               try {
                in.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }


In the above code, the threads are created and executed independently, but
using same Connection tuple.

Can you please let me know where to set SmbSession.matches() to false ?

Thanks
Chitu

2009/1/22 Michael B Allen <ioplex at gmail.com>

> On Wed, Jan 21, 2009 at 10:34 PM, Cittarasu Thirunavukkarasu
> <cittarasu at gmail.com> wrote:
> > Hi,
> >
> > Can I create multiple flows for the same server ( different TCP flows )
> > using smbfile module ? How do I specify the lport so that it can create
> > different TCP flows to same CIFS server ?
>
> If you set:
>
>  jcifs.smb.client.ssnLimit = 1
>
> and use a different username for each file (user1, user2, user3, ...
> etc) you will get different TCP connections.
>
> But I don't think you can do it with the same username. You could
> sabotage the code so that jcifs/smb/SmbSession.matches() always
> returns false.
>
> Mike
>
> --
> Michael B Allen
> Java Active Directory Integration
> http://www.ioplex.com/
>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list