[TIMOB-10836] BlackBerry: Socket connected callback is not actually called
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-08-09T17:27:28.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 16, 2013 Sprint 16 API |
Components | BlackBerry |
Labels | n/a |
Reporter | Hayk Zakaryan |
Assignee | Pedro Enrique |
Created | 2012-09-11T04:22:17.000+0000 |
Updated | 2017-03-08T18:52:28.000+0000 |
Description
When creating client socket and providing 'connected' callback function is not called actually.
Example code can be found in KitchenSink Resources\ui\common\platform\socket_connect.js
connectButton.addEventListener part.(~line 120)
connectingSocket = Ti.Network.Socket.createTCP({
host:hostField.value,
port: parseInt(portField.value),
connected:function(e) {
e.socket.write(Ti.createBuffer({value:"Well, hello there!"}));
Ti.Stream.pump(e.socket,pumpCallback,1024, true);
},
error:function(e) {
statusArea.value = "ERROR ("+e.errorCode+"): "+e.error;
},
closed:function(e) {
statusArea.value = "CLOSED CONNECTION TO: "+e.socket.host+":"+e.socket.port;
}
});
connectingSocket.connect();
For testing added simple alert in the connected callback function and it did not appeared.
Before that started a listener in my computer - port 40405.
opened the KS app Platform->Sockets->Connecting socket. Typed host 127.0.0.1 port 40405 and clicked connect button.
Listener Socket mentioned that client connected but actual connected callback didn't worked on the simulator
In order for the port to be correct - port value should be parsed to Number as - port: parseInt(portField.value),
(not as port:portField.value - in KS original version).
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.
node.js
app.js
Closing ticket as the issue cannot be reproduced.