title: Android ServerSocket programming with jCIFS streaming files
body: <p>I've got a bit of an issue and I've been asking regarding it quite a few times, but I think I'm one step closer now, so hopefully someone can help me with the rest.</p>
  
  <p>My previous questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/8583277/connect-to-nas-device-from-android">Connect to NAS device from Android</a></li>
  <li><a href="https://stackoverflow.com/questions/8030769/how-to-open-files-in-android-with-default-viewer-using-jcifs">How to open files in Android with default viewer using jCIFS</a></li>
  </ul>
  
  <p><strong>Put simply - I want to create an application that:</strong></p>
  
  <ol>
  <li>Can connect to a NAS device using jCIFS</li>
  <li>Is capable of launching files in the default viewer - i.e. a video in the video player</li>
  </ol>
  
  <p>The first part is relatively easy and I've already done that, but the second part is what's troubling me and what I've asked about a few times before. I think I've made some progress though.</p>
  
  <p>I think I need to use a <code>ServerSocket</code> in my application to somehow create a bridge between the NAS and the application that's playing the content. I'm thinking this could be done using a <code>Service</code>. The files from the NAS device can be accessed as a <code>FileInputStream</code>.</p>
  
  <p>There are plenty of applications on Market (i.e. <a href="https://market.android.com/details?id=com.estrongs.android.pop" rel="nofollow noreferrer">ES File Explorer</a>) that are capable of doing this without root access, so I know it's possible - at the moment I just don't know how.</p>
  
  <p><img src="https://i.stack.imgur.com/ntfsE.jpg" alt="Illustration of my idea"></p>
  
  <p>I've been looking at Logcat while using some of the aforementioned applications, and they all seem to be creating a local server and then launch a video <code>Intent</code> from that server. How can this be achieved?</p>