{ "id": "125190", "key": "AC-2620", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-02-04T05:36:02.000+0000", "created": "2014-01-22T03:46:00.000+0000", "labels": [ "api", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:41:42.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Steps to reproduce\r\n1. Have a network printer configured with IP 192.168.20.175 and Port 9100\r\nMake sure the computer where emulator running on and printer are both in the same network\r\n2. Drop the attachment into project Documents folder \r\n3. Run the code below using iOS 7.0.3 and Ti SDK 3.2.0 \r\n\r\nh4.Test Code\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\ttitle : \"Test Window\"\r\n});\r\n\r\nvar t = Ti.UI.createButton({\r\n\ttitle : \"generate\",\r\n\tbottom : 10,\r\n\theight : 40\r\n});\r\nwin.add(t);\r\n\r\nt.addEventListener(\"click\", function(e) {\r\n\tvar xData = psc();\r\n\tletsPrint(xData);\r\n});\r\n\r\nfunction psc() {\r\n\ttry {\r\n\t\tvar f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, \"signature_bin.bin\");\r\n\t\t// var sigBin = sigBlob;\r\n\t\t// //f.write(\"Signature: \\n\");\r\n\t\t// var bo = f.write(sigBin);\r\n\t\tvar fileStream = f.open(Ti.Filesystem.MODE_READ);\r\n\t\tvar buf = Ti.Stream.readAll(fileStream);\r\n\t\treturn buf;\r\n\t} catch (e) {\r\n\t\talert(e);\r\n\t}\r\n}\r\n\r\nfunction letsPrint(data) {\r\n\tvar socket = Ti.Network.Socket.createTCP({\r\n\t\thost : '192.168.20.175',\r\n\t\tport : 9100,\r\n\t\tconnected : function(e) {\r\n\t\t\tTi.API.info('Socket opened!');\r\n\t\t\tTi.Stream.pump(e.socket, readCallback, 1024, true);\r\n\t\t\tTi.Stream.write(socket, data, writeCallback);\r\n\t\t},\r\n\t\terror : function(e) {\r\n\t\t\tTi.API.info('Error (' + e.errorCode + '): ' + e.error);\r\n\t\t},\r\n\t});\r\n\tsocket.connect();\r\n\r\n\tfunction writeCallback(e) {\r\n\t\tTi.API.info('Successfully wrote to socket.');\r\n\t}\r\n\r\n\tfunction readCallback(e) {\r\n\t\tif (e.bytesProcessed == -1) {\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tif (e.buffer) {\r\n\t\t\t\tvar received = e.buffer.toString();\r\n\t\t\t\tTi.API.info('Received: ' + received);\r\n\t\t\t} else {\r\n\t\t\t\tTi.API.error('Error: read callback called with no buffer!');\r\n\t\t\t}\r\n\t\t} catch (ex) {\r\n\t\t\tTi.API.error(ex);\r\n\t\t}\r\n\t}\r\n}\r\n{code}\r\n\r\n\r\nh4.Expected Result\r\nSignature printed out on docket\r\n\r\nh4.Actual Result\r\nNothing printed\r\n\r\n\r\nh3.{color:red}But the above code produces expected result on iOS 6.0 and Ti.SDK 2.1.4{color}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "attachment": [ { "id": "45285", "filename": "signature_bin.bin", "author": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-22T03:46:00.000+0000", "size": 11994, "mimeType": "application/macbinary" } ], "flagged": false, "summary": "Data transmission via socket seems corruptted on latest SDK", "creator": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 7.0.3\r\nSDK 3.2.0", "comment": { "comments": [ { "id": "289388", "author": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can anybody treat it urgently as our mobile product relies much on this and it cannot behave without the bug fix.\n\nThanks", "updateAuthor": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-23T10:34:52.000+0000", "updated": "2014-01-23T10:34:52.000+0000" }, { "id": "289571", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~jialhe85@gmail.com] It is tedious to diagnose this issue with network printer setup. Can you please try to reproduce this issue with a simple node based server instead of printer? It would also help us to narrow down the problem and expedite the problem diagnosis.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-24T07:18:37.000+0000", "updated": "2014-01-24T07:18:37.000+0000" }, { "id": "290163", "author": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Ritu\n\nAfter hours of investigations, I found that it seems like a problem with Model window in 3.2.0. I will re-produce the test code later. Thanks", "updateAuthor": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-29T02:28:14.000+0000", "updated": "2014-01-29T02:28:14.000+0000" }, { "id": "290571", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~jialhe85@gmail.com] Did you get a chance to reproduce this problem with the model window?", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-31T04:18:26.000+0000", "updated": "2014-01-31T04:18:26.000+0000" }, { "id": "291074", "author": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Ritu\n\nI am sorry that I could not reproduce this issue in model window. No idea why. Can you please close this ticket as invalid?\n\nThanks", "updateAuthor": { "name": "jialhe85@gmail.com", "key": "jialhe85@gmail.com", "displayName": "David He", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-04T04:49:39.000+0000", "updated": "2014-02-04T04:49:39.000+0000" }, { "id": "291075", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing this ticket as invalid based on reporter's request.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-04T05:36:02.000+0000", "updated": "2014-02-04T05:36:12.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }