Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12079] Android: Data retrived from a socket is corrupt when writing to file

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2013-04-25T15:50:30.000+0000
Affected Version/sRelease 2.1.3, Release 2.1.4, Release 3.0.0, Release 3.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsexalture
ReporterDaniel Sefton
AssigneeSunila
Created2012-12-12T22:36:15.000+0000
Updated2017-03-24T17:53:13.000+0000

Description

*Problem description* When writing an image obtained from a TCP socket to file, the file is becoming corrupt and the image isn't displayed. The binary data that we are receiving from the socket is proper in size but after writing to the file the size is greater than the actual image. *Log*
12-12 14:28:02.150: I/TiAPI(29051): Successfully total read. 83122
12-12 14:28:02.150: I/TiFileProxy(29051): (KrollRuntimeThread) [2,1061] Unable to write to an unrecognized file type
*Test case* Attached.

Attachments

FileDateSize
zTCP.zip2012-12-12T22:36:15.000+0000755070

Comments

  1. Daniel Sefton 2012-12-12

    Tested and confirmed on Samsung Galaxy S2 2.3.6 and Android Emulator Ti SDK 3.0.0, 2.1.3 GA, and 2.1.4 GA.
  2. jithinpv 2013-03-21

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4 jithinpv
  3. Sunila 2013-04-25

    Couple of issues with the sample. 1. The error "Unable to write to an unrecognized file type" is because the tmpFile.write(e.buffer, true) where e.buffer is of Titanium.Buffer and File.Write doesn't support this Buffer type 2. The file size is too large because the file is not binary. Use FileStream(Ti.Filesystem.openStream) instead of File to write the binary data
  4. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source