[jcifs] newbie problems
Mark Shifman
mark.shifman at yale.edu
Mon Jul 18 16:39:17 GMT 2005
Michael B Allen wrote:
>On Mon, 18 Jul 2005 09:48:26 -0400
>Mark Shifman <mark.shifman at yale.edu> wrote:
>
>
>>>Add some System.out.printlns to SmbTransport.java:228 to print all of the arguments passed to the Socket constructor.
>>>
>>>
>>>
>> System.out.println("address " + address.getHostAddress() + "
>>port " + port + " localAddr " + localAddr+" local port " + localPort);
>> socket = new Socket( address.getHostAddress(), port,
>>localAddr, localPort );
>>...
>>outputs:
>>address 172.23.78.119 port 445 localAddr moussaka/127.0.0.1 local port 0
>>
>>So the constructor doesn't like what it is given as localAddr. If I
>>put my real ip adress in , the socket is created.
>>Either I have my machine configured strangely (it seems to work with
>>everything else) or jcifs is picking up my local address incorrectly
>>or (the most likely) I don't really understand what is going on.
>>mas
>>
>>
>
>You don't have a loopback adapter. I've seen this before on
>Windows machines. Either you need to setup loopback or use the
>jcifs.smb.client.laddr property to set the address of the interface
>to use.
>
>
>
When I set jcifs.Config.setProperty( "jcifs.smb.client.laddr",
"myipaddress" );
It finally worked.
I am running under linx with loopback defined in a standard fashion from
ifconfig:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:104 errors:0 dropped:0 overruns:0 frame:0
TX packets:104 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5676 (5.5 Kb) TX bytes:5676 (5.5 Kb)
>We could put a clause in the code like:
>
> if (localAddr == InetAddress.getLocalHost()) {
> socket = new Socket( address.getHostAddress(), port );
> } else {
> socket = new Socket( address.getHostAddress(), port, localAddr, localPort );
> }
>
>If you leave out the localAddr and localPort properties alltogether does
>it work ok?
>
>
Yes!
By the way, someone left a
System.out.print(" " + name );
in SmbFile.java (at least in the tgz I downloaded) line 1705.
Thanks for your help
mas
>Mike
>
>
>
--
Mark Shifman MD. Ph.D.
Yale Center for Medical Informatics
Phone (203)737-5219
mark.shifman at yale.edu
More information about the jcifs
mailing list