title: Get photo from android server to iOS
body: <p>I want to send image file from android server to iOS client. I'm using swift language and socket programming(ip-port). There is connection. I send/get string data but i can't get image file. How can i get image file on swift side?</p>
  
  <p><a href="http://android-er.blogspot.com.tr/2015/01/transfer-image-between-android-devices.html" rel="nofollow">i want to make like this app</a></p>
  
  <pre><code>        if aStream == self.inputStream{
              var buffer: UInt8 = 0
              var len: Int!
  
  
              while (inputStream?.hasBytesAvailable != nil){
                  len = inputStream?.read(&amp;buffer, maxLength: 2048)
  
                  if len &gt; 0{
  
                      var output = NSData(bytes: &amp;buffer, length: len)
  
                      if output != nil{
  
                          var img = UIImage(data: output) //Error !!!
  
                      }
                  } 
              }
          }
  </code></pre>