[jcifs] newbie problems and connection problem on unix box
Mark Shifman
mark.shifman at yale.edu
Tue Jul 19 13:33:39 GMT 2005
Michael B Allen wrote:
>On Mon, 18 Jul 2005 12:39:17 -0400
>Mark Shifman <mark.shifman at yale.edu> wrote:
>
>
>
>>>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)
>>
>>
>
>Linux ehh? Odd. Something's definately wrong there. Actually I think
>there might be something about this in the FAQ.
>
>
Yes! Here it is.
* *Your hostname is resolving to 127.0.0.1.* It is not uncommon on
Linux for an /etc/hosts file to map the hostname to 127.0.0.1 such
as:
127.0.0.1 nano localhost.localdomain localhost
Taking the host name (e.g. nano) out of the localhost line should
solved the problem.
This is a bit tedious though if you are testing on one linux box and
then running on another box. Also if you like using the short name for
your computer
Since getLocalHost returns a short name for my computer, this might be a
reasonable solution
jcifs.Config.setProperty( "jcifs.smb.client.laddr",
InetAddress.getLocalHost().getHostName()+"rest.of.domain");
mas
>
>
>>>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.
>>
>>
>
>Oh no! Who did that?
>
>:->
>
>JCIFS 1.2.2 coming up .....
>
>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