Android Question Network Login to Windows PC Shared Folder

Discussion in 'Android Questions' started by A Z M JANNAT UL KARIM, Jul 22, 2019.

  1. A Z M JANNAT UL KARIM

    A Z M JANNAT UL KARIM Member Licensed User

    Hi, I am using an apps in local computer which will access some images from network URL like \\192.168.0.22\image$\image01.jpg and put in some label. But the shared folder can only be access through some login credential. Can I use any Login credential from Apps before accessing the file. Thank you :)
     
  2. MarkusR

    MarkusR Well-Known Member Licensed User

    should be possible with a SMB library

    https://en.wikipedia.org/wiki/Server_Message_Block

    SMB-Version 3.1.1 > Windows 10 / Windows Server 2016 / Samba 4.3
     
  3. A Z M JANNAT UL KARIM

    A Z M JANNAT UL KARIM Member Licensed User

    Hi Markus, thank you for your link. I had tried it now and for some reason I am getting following error !!!

    Code:
    Logger connected to:  HUAWEI BGO-DL09
    --------- beginning of system
    --------- beginning of main
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ** 
    Activity (main) Pause, UserClosed = false **
    sending message 
    to waiting queue (smb1_listcompleted)
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ** 
    Activity (main) Pause, UserClosed = false **
    sending message 
    to waiting queue (smb1_listcompleted)
    running waiting messages (
    1)
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    ** 
    Activity (main) Resume **
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    ** 
    Activity (main) Pause, UserClosed = true **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    ListCompleted
    ListFiles failed : (SmbException) jcifs.smb.SmbException: Failed 
    to connect: 0.0.0.0<00>/192.168.2.246
    jcifs.util.transport.TransportException
    java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:
    595)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    559)
        at java.net.PlainSocketImpl.read(PlainSocketImpl.java:
    481)
        at java.net.PlainSocketImpl.access$
    000(PlainSocketImpl.java:37)
        at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:
    237)
        at jcifs.util.transport.Transport.readn(Transport.java:
    29)
        at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:
    388)
        at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:
    288)
        at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:
    319)
        at jcifs.util.transport.Transport.run(Transport.java:
    241)
        at java.lang.Thread.run(
    Thread.java:833)
    Caused by: android.system.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
        at libcore.io.Posix.recvfromBytes(Native Method)
        at libcore.io.Posix.recvfrom(Posix.java:
    189)
        at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:
    250)
        at libcore.io.IoBridge.recvfrom(IoBridge.java:
    556)
        ... 
    9 more
        at jcifs.util.transport.Transport.run(Transport.java:
    258)
        at java.lang.Thread.run(
    Thread.java:833)
    For Information the folder is in Windows 10 v1903 System. Had turn off password protected sharing. Folder shared with Everyone / Read Only. Also had SetCredentials for it. Following is the code for your reference ...

    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        'Activity.LoadLayout("Layout1")
        If FirstTime Then
            SMB1.SetCredentials(
    "user","123456","")
            SMB1.Initialize(
    "SMB1")
        
    End If
        SMB1.ListFiles(
    "smb://192.168.2.246/images/""")
    End Sub

    Sub SMB1_ListCompleted(Url As String, Success As Boolean, Entries() As SMBFile)
    Log("ListCompleted")
    ' Return
      If Not(Success) Then
          
    Log("ListFiles failed : " & LastException)
      
    Else
        
    For i = 0 To Entries.Length - 1
            
    Log("*****************")
            
    Log(Entries(i).Name)
            
    Log(Entries(i).Directory)
            
    Log(DateTime.Date(Entries(i).LastModified))
            
    Log(Entries(i).Parent)
            
    Log(Entries(i).Size)
          
    Next
      
    End If
    End Sub
    Thank you ...
     
  4. MarkusR

    MarkusR Well-Known Member Licensed User

    you checked also windows firewall?
     
  5. A Z M JANNAT UL KARIM

    A Z M JANNAT UL KARIM Member Licensed User

    Can you please tell me which PORT need to check. I can access from other PC through the URL with Credentials.
     
  6. MarkusR

    MarkusR Well-Known Member Licensed User

  7. DonManfred

    DonManfred Expert Licensed User

  8. A Z M JANNAT UL KARIM

    A Z M JANNAT UL KARIM Member Licensed User

    MarkusR likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice