'station' only gets assigned a value after the onConnect and onData callbacks are invoked, which is not immediately after the call to socket.connect(), so at the point where you are converting 'station' to an array, 'station' is not yet defined. After invoking "GetTuner()", the TCP socket will be connecting, but onConnect and onData will only get called later on, so GetTuner() cannot ...



