{ "id": "164547", "key": "TIMOB-24226", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-01-23T02:04:35.000+0000", "created": "2016-11-16T06:14:16.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "error", "tcp", "undefined", "windows", "windowsphone" ], "versions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "issuelinks": [], "assignee": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-02-23T01:18:46.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": "15101", "name": "Windows phone", "description": "Windows phone platform" } ], "description": "Hello\r\nI need to develop a Windows Phone app that performs communication via TCP socket. Specifically, it is an extension of an already developed apps for iOS and Android platforms with Titanium SDK.\r\nSeeing that the development of the TCP part is found only in the 6.1.0.x SDK version I have updated Appcelerator SDK and Studio to the latest versions.\r\nThe TCP client implementation is present and working but I encountered some problems with sending messages, specifically it seems that the second message sent creates an error that crashes the application.\r\nI quote here the the error log and test the application code.\r\nThe TCP server is a simple nodejs echo script that responds with the message received.\r\n\r\n*Studio Console Log*\r\n{noformat}\r\n-- Start application log -----------------------------------------------------\r\n[INFO] [TEST] open connection\r\n[INFO] [TEST] connected\r\n[INFO] : Finished launching the application\r\n[INFO] [TEST] try to send\r\n[INFO] [TEST] sent\r\n[INFO] [TEST] received: 0 0 0 0 14 a0\r\n[INFO] [TEST] try to send\r\n[ERROR] : ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : In undefined: undefined,undefined\r\n[ERROR] : Message: Uncaught Error: undefined\r\n[INFO] : Disconnected from app\r\n-- End application log -------------------------------------------------------\r\n{noformat}\r\n\r\n*Test Code*\r\n{code:java}\r\n\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar lbl = Ti.UI.createLabel({\r\n\ttext: 'TCP Test'\r\n});\r\nwin.add(lbl);\r\n\r\nwin.addEventListener('open', function()\r\n{\r\n\tvar itv;\r\n\t\r\n\tvar socket = Ti.Network.Socket.createTCP({\r\n\t\thost: '192.168.1.88',\r\n\t port: 6262,\r\n\t timeout: 3000,\r\n\t connected: function(e)\r\n\t {\r\n\t \tconsole.log(\"[TEST] connected\");\r\n\t \t\r\n\t \tTi.Stream.pump(e.socket, function(e)\r\n\t \t{\r\n\t\t\t\tif (e.bytesProcessed == -1)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Socket :: END of received message\r\n\t\t\t return;\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t var res = [];\r\n\t\t\t \r\n\t\t\t for(var i = 0, len = e.buffer.length; i < len; i++)\r\n\t\t\t {\r\n\t\t\t \tres.push(e.buffer[i].toString(16));\r\n\t\t\t }\r\n\t\t\t \r\n\t\t\t console.log(\"[TEST] received: \" + res.join(\" \"));\r\n\t \t\t\r\n\t \t}, 1024, true);\r\n\t \t\r\n\t \titv = setInterval(function()\r\n\t \t{\r\n\t \t\tif(!socket)\r\n\t \t\t{\r\n\t \t\t\tclearInterval(itv);\r\n\t \t\t\t\r\n\t \t\t\treturn;\r\n\t \t\t}\r\n\t \t\t\r\n\t \t\tvar buff = Ti.createBuffer({\r\n\t\t\t\t\tlength: 6\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\tbuff[0] = 0x00;\r\n\t\t\t\tbuff[1] = 0x00;\r\n\t\t\t\tbuff[2] = 0x00;\r\n\t\t\t\tbuff[3] = 0x00;\r\n\t\t\t\tbuff[4] = 0x14;\r\n\t\t\t\tbuff[5] = 0xA0;\r\n\t\t\t\t\r\n\t\t\t\tconsole.log(\"[TEST] try to send\");\r\n\t\t\t\t\r\n\t\t\t\tTi.Stream.write(socket, buff, function()\r\n\t\t\t\t{\r\n\t\t\t\t\tconsole.log('[TEST] sent');\r\n\t\t\t\t});\r\n\r\n\r\n\t \t}, 1000);\r\n\t },\r\n\t\terror: function(e)\r\n\t\t{\r\n\t\t\tclearInterval(itv);\r\n\t\t\t\r\n\t\t\tsocket = null;\r\n\t\t\t\r\n\t\t\tconsole.error(\"[TEST] socket error\");\r\n\t\t\t\r\n\t\t\tconsole.error(e);\r\n\t\t}\r\n\t});\r\n\t\r\n\tconsole.log(\"[TEST] open connection\");\r\n\t\r\n\tsocket.connect();\r\n});\r\n\r\nwin.open();\r\n\r\n{code}\r\n\r\n\r\n", "attachment": [ { "id": "61665", "filename": "TCPWriteErrorScreenShot.PNG", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-23T00:19:43.000+0000", "size": 35571, "mimeType": "image/png" } ], "flagged": false, "summary": "Windows: Phone TCP Write Error", "creator": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "subtasks": [], "reporter": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "environment": "OS: Windows 10 Pro\r\nEmulator: Mobile Emulator 10.0.14393.0 720p 5 inch 1GB\r\nStudio: 4.8.0.201611011053\r\nappc 6.0.0-68\r\nTitanium SDK 6.1.0.v20161113203131", "closedSprints": [ { "id": 796, "state": "closed", "name": "2017 Sprint 02 SDK", "startDate": "2017-01-15T00:00:41.845Z", "endDate": "2017-01-29T00:00:00.000Z", "completeDate": "2017-01-30T21:10:44.640Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "402634", "author": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "body": "Hello, there are updates on this issue?", "updateAuthor": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "created": "2016-12-06T06:05:27.000+0000", "updated": "2016-12-06T06:05:27.000+0000" }, { "id": "403610", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-12-19T14:24:37.000+0000", "updated": "2016-12-19T14:24:37.000+0000" }, { "id": "405008", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/titanium_mobile_windows/pull/931", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-21T00:12:07.000+0000", "updated": "2017-01-21T00:12:07.000+0000" }, { "id": "405264", "author": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "body": "Hello, I made a comment on github.\r\nThe application crashes problem seems solved but not yet seem to be proper communication.", "updateAuthor": { "name": "sandrolain", "key": "sandrolain", "displayName": "Sandro Lain", "active": true, "timeZone": "Europe/Rome" }, "created": "2017-01-25T10:17:05.000+0000", "updated": "2017-01-25T10:17:05.000+0000" }, { "id": "407636", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested using environment: \r\nNPM Version: 2.15.9 \r\nNode Version: 4.5.0 \r\nWindows OS: Windows 10 Build 14393.693 \r\nAppc CLI: 6.1.0 \r\nAppc CLI NPM: 4.2.8 \r\nTitanium SDK version: 6.1.0.v20170220091247 \r\nAppcelerator Studio, build: 4.8.1.201612050850 \r\nWindows OS: Windows 10 Build 14393.693 \r\nWindows Device: 10.0.14393.693\r\n\r\nValidated that messages are being sent between demo client app and server demo app.\r\n[~kota] Can you please verify from the screenshot, that these are the expected messages from the console and the node app?\r\n\r\n!TCPWriteErrorScreenShot.PNG|thumbnail!", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-23T00:19:13.000+0000", "updated": "2017-02-23T00:23:38.000+0000" }, { "id": "407637", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~amukherjee] Yes, looking good! (y)", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-02-23T00:29:19.000+0000", "updated": "2017-02-23T00:29:19.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }