{ "id": "100758", "key": "TIMOB-10836", "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": "15576", "description": "2013 Sprint 16", "name": "2013 Sprint 16", "archived": true, "released": true, "releaseDate": "2013-08-12" }, { "id": "15578", "description": "2013 Sprint 16 API", "name": "2013 Sprint 16 API", "archived": true, "released": true, "releaseDate": "2013-08-12" } ], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2013-08-09T17:27:28.000+0000", "created": "2012-09-11T04:22:17.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-08T18:52:28.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": "10230", "name": "BlackBerry", "description": "BlackBerry Platform" } ], "description": "When creating client socket and providing 'connected' callback function is not called actually.\r\nExample code can be found in KitchenSink Resources\\ui\\common\\platform\\socket_connect.js\r\nconnectButton.addEventListener part.(~line 120)\r\nconnectingSocket = Ti.Network.Socket.createTCP({\r\n\t\t\t\t\thost:hostField.value,\r\n\t\t\t\t\tport: parseInt(portField.value),\r\n\t\t\t\t\tconnected:function(e) {\r\n\t\t\t\t\t\te.socket.write(Ti.createBuffer({value:\"Well, hello there!\"}));\r\n\t\t\t\t\t\tTi.Stream.pump(e.socket,pumpCallback,1024, true);\r\n\t\t\t\t\t},\r\n\t\t\t\t\terror:function(e) {\r\n\t\t\t\t\t\tstatusArea.value = \"ERROR (\"+e.errorCode+\"): \"+e.error;\r\n\t\t\t\t\t},\r\n\t\t\t\t\tclosed:function(e) {\r\n\t\t\t\t\t\tstatusArea.value = \"CLOSED CONNECTION TO: \"+e.socket.host+\":\"+e.socket.port;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tconnectingSocket.connect();\r\nFor testing added simple alert in the connected callback function and it did not appeared.\r\n\r\nBefore that started a listener in my computer - port 40405. \r\nopened the KS app Platform->Sockets->Connecting socket. Typed host 127.0.0.1 port 40405 and clicked connect button.\r\nListener Socket mentioned that client connected but actual connected callback didn't worked on the simulator\r\n\r\nIn order for the port to be correct - port value should be parsed to Number as - port: parseInt(portField.value),\r\n(not as port:portField.value - in KS original version).\r\n", "attachment": [], "flagged": false, "summary": "BlackBerry: Socket connected callback is not actually called", "creator": { "name": "hzakaryan", "key": "hzakaryan", "displayName": "Hayk Zakaryan", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "hzakaryan", "key": "hzakaryan", "displayName": "Hayk Zakaryan", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "BlackBerry Simulator", "comment": { "comments": [ { "id": "265728", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Tested on device. Connected computer to the same wifi network as the device. Got IP address. Created a node.js proxy server on port 9999. Tested sample app. It worked fine.\r\n\r\nh3. node.js\r\n{code}\r\n\r\nvar net = require('net');\r\n\r\nnet.createServer(function(socket) {\r\n\r\n socket.on('data', function(buffer) {\r\n \t\r\n \tvar str = buffer.toString('ascii');\r\n \tvar arr = str.split('\\n');\r\n \tif(arr.length > 1) {\r\n\t \tfor(var i = 0, len = arr.length - 1; i < len; i++) {\r\n\t\t \tconsole.log('[INFO] ' + arr[i]);\r\n\t \t}\r\n\t } else {\r\n console.log('[INFO] ' + str);\r\n }\r\n });\r\n\r\n socket.on('end', function() {\r\n \tconsole.log('end');\r\n });\r\n\r\n}).listen(9999);\r\n{code}\r\n\r\nh3. app.js\r\n{code}\r\nTi.UI.setBackgroundColor('white');\r\n\r\nvar win = Ti.UI.createWindow({\r\n});\r\n \r\nvar btn = Ti.UI.createButton({\r\n\tbottom: 0\r\n});\r\nwin.add(btn);\r\n\r\nbtn.addEventListener('click', function(e){\r\n\tvar clientSocket = Ti.Network.Socket.createTCP({\r\n\t host : '172.16.0.115',\r\n\t port : 9999,\r\n\t connected : function(e) {\r\n\t Ti.API.info('Client socket connected!');\r\n\t Ti.Stream.pump(e.socket, pumpCallback, 1024, true);\r\n\t e.socket.write(Ti.createBuffer({\r\n\t value : 'A message from a connecting socket.'\r\n\t }));\r\n\t },\r\n\t error : function(e) {\r\n\t Ti.API.info('Error (' + e.errorCode + '): ' + e.error);\r\n\t }\r\n\t});\r\n\tclientSocket.addEventListener('connected', function(e){\r\n\t\tTi.API.info('Connected!!!!!!!');\r\n\t\tTi.API.info(e);\r\n\t\te.socket.write(Ti.createBuffer({\r\n value : 'Connected'\r\n }));\r\n\t});\r\n\tfunction writeCallback(e) {\r\n\t Ti.API.info('Successfully wrote to socket.');\r\n\t}\r\n\r\n\tfunction pumpCallback(e) {\r\n\t // Has the remote socket closed its end?\r\n\t if (e.bytesProcessed < 0) {\r\n\t Ti.API.info(\"Closing client socket.\");\r\n\t clientSocket.close();\r\n\t return;\r\n\t }\r\n\t try {\r\n\t if(e.buffer) {\r\n\t var received = e.buffer.toString();\r\n\t Ti.API.info('Received: ' + received);\r\n\t } else {\r\n\t Ti.API.error('Error: read callback called with no buffer!');\r\n\t }\r\n\t } catch (ex) {\r\n\t Ti.API.error(ex);\r\n\t }\r\n\t}\r\n\tclientSocket.connect();\r\n\r\n});\r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-08-09T17:27:28.000+0000", "updated": "2013-08-09T17:27:28.000+0000" }, { "id": "409918", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as the issue cannot be reproduced.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-08T18:52:28.000+0000", "updated": "2017-03-08T18:52:28.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }