{ "id": "141622", "key": "TIMOB-18246", "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": [], "resolution": null, "resolutiondate": null, "created": "2014-12-16T00:37:53.000+0000", "priority": null, "labels": [ "defect", "ios" ], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:19.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [], "description": "Run the test code as follow will reproduce this error.\r\n\r\n{code:title=\"socket\"}\r\nvar hostname = '127.0.0.1';\r\n\r\nvar clientSocket = Ti.Network.Socket.createTCP({\r\n\thost : hostname,\r\n\tport : 40404,\r\n\tconnected : function(e) {\r\n\t\tTi.API.info('Client socket connected!');\r\n\t\tTi.Stream.pump(e.socket, pumpCallback, 1024, true);\r\n\t\te.socket.write(Ti.createBuffer({\r\n\t\t\tvalue : 'A message from a connecting socket.'\r\n\t\t}));\r\n\t},\r\n\terror : function(e) {\r\n\t\tTi.API.info('Error (' + e.errorCode + '): ' + e.error);\r\n\t}\r\n});\r\n\r\nfunction writeCallback(e) {\r\n\tTi.API.info('Successfully wrote to socket.');\r\n}\r\n\r\nfunction pumpCallback(e) {\r\n\t// Has the remote socket closed its end?\r\n\tif (e.bytesProcessed < 0) {\r\n\t\tTi.API.info(\"Closing client socket.\");\r\n\t\tclientSocket.close();\r\n\t\treturn;\r\n\t}\r\n\ttry {\r\n\t\tif (e.buffer) {\r\n\t\t\tvar received = e.buffer.toString();\r\n\t\t\tTi.API.info('Received: ' + received);\r\n\t\t} else {\r\n\t\t\tTi.API.error('Error: read callback called with no buffer!');\r\n\t\t}\r\n\t} catch (ex) {\r\n\t\tTi.API.error(ex);\r\n\t}\r\n}\r\n\r\n//Create a socket and listen for incoming connections\r\nvar listenSocket = Ti.Network.Socket.createTCP({\r\n\thost : hostname,\r\n\tport : 40404,\r\n\taccepted : function(e) {\r\n\t\t// This where you would usually store the newly-connected socket, e.inbound\r\n\t\t// so it can be used for read / write operations elsewhere in the app.\r\n\t\t// In this case, we simply send a message then close the socket.\r\n\t\tTi.API.info(\"Listening socket <\" + e.socket + \"> accepted incoming connection <\" + e.inbound + \">\");\r\n\t\te.inbound.write(Ti.createBuffer({\r\n\t\t\tvalue : 'You have been connected to a listening socket.\\r\\n'\r\n\t\t}));\r\n\t\te.inbound.close();\r\n\t\t// close the accepted socket\r\n\r\n\t},\r\n\terror : function(e) {\r\n\t\tTi.API.error(\"Socket <\" + e.socket + \"> encountered error when listening\");\r\n\t\tTi.API.error(\" error code <\" + e.errorCode + \">\");\r\n\t\tTi.API.error(\" error description <\" + e.error + \">\");\r\n\t}\r\n});\r\n// Starts the socket listening for connections, does not accept them\r\nlistenSocket.listen();\r\nTi.API.info(\"Listening now...\");\r\n\r\n// Tells socket to accept the next inbound connection. listenSocket.accepted gets\r\n// called when a connection is accepted via accept()\r\nTi.API.info(\"Calling accept.\");\r\nlistenSocket.accept({\r\n\ttimeout : 10000\r\n});\r\n\r\n// Call connect after a short timeout to ensure the listening socket is ready to go.\r\nTi.API.info(\"Setting timer to connect.\");\r\nsetTimeout(function(e) {\r\n\tTi.API.info(\"Calling connect on client socket.\");\r\n\tclientSocket.connect();\r\n\t//listenSocket.isWriteable(); throw an error as undefined is not a function\r\n\tlistenSocket.isReadable();\r\n}, 500); \r\n{code}", "attachment": [], "flagged": false, "summary": "socket isWriteable method is undefined", "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.1\r\nTi SDK 3.3.0", "comment": { "comments": [], "maxResults": 1, "total": 1, "startAt": 0 } } }