Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 6.1.0
    • Fix Version/s: Release 6.1.0
    • Component/s: Windows phone
    • Environment:

      OS: Windows 10 Pro
      Emulator: Mobile Emulator 10.0.14393.0 720p 5 inch 1GB
      Studio: 4.8.0.201611011053
      appc 6.0.0-68
      Titanium SDK 6.1.0.v20161113203131

    • Story Points:
      3
    • Sprint:
      2017 Sprint 02 SDK

      Description

      Hello
      I 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.
      Seeing 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.
      The 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.
      I quote here the the error log and test the application code.
      The TCP server is a simple nodejs echo script that responds with the message received.

      Studio Console Log

      -- Start application log -----------------------------------------------------
      [INFO] [TEST] open connection
      [INFO] [TEST] connected
      [INFO] :   Finished launching the application
      [INFO] [TEST] try to send
      [INFO] [TEST] sent
      [INFO] [TEST] received: 0 0 0 0 14 a0
      [INFO] [TEST] try to send
      [ERROR] :  ----- Titanium Javascript Runtime Error -----
      [ERROR] :  In undefined: undefined,undefined
      [ERROR] :  Message: Uncaught Error: undefined
      [INFO] :   Disconnected from app
      -- End application log -------------------------------------------------------
      

      Test Code

       
      var win = Ti.UI.createWindow();
       
      var lbl = Ti.UI.createLabel({
      	text: 'TCP Test'
      });
      win.add(lbl);
       
      win.addEventListener('open', function()
      {
      	var itv;
      	
      	var socket = Ti.Network.Socket.createTCP({
      		host: '192.168.1.88',
      	    port: 6262,
      	    timeout: 3000,
      	    connected: function(e)
      	    {
      	    	console.log("[TEST] connected");
      	    	
      	    	Ti.Stream.pump(e.socket, function(e)
      	    	{
      				if (e.bytesProcessed == -1)
      				{
      					// Socket :: END of received message
      			        return;
      			    }
      			    
      			    var res = [];
      			    
      			    for(var i = 0, len = e.buffer.length; i < len; i++)
      			    {
      			    	res.push(e.buffer[i].toString(16));
      			    }
      			    
      			    console.log("[TEST] received: " + res.join(" "));
      	    		
      	    	}, 1024, true);
      	    	
      	    	itv = setInterval(function()
      	    	{
      	    		if(!socket)
      	    		{
      	    			clearInterval(itv);
      	    			
      	    			return;
      	    		}
      	    		
      	    		var buff = Ti.createBuffer({
      					length: 6
      				});
      				
      				buff[0] = 0x00;
      				buff[1] = 0x00;
      				buff[2] = 0x00;
      				buff[3] = 0x00;
      				buff[4] = 0x14;
      				buff[5] = 0xA0;
      				
      				console.log("[TEST] try to send");
      				
      				Ti.Stream.write(socket, buff, function()
      				{
      					console.log('[TEST] sent');
      				});
       
       
      	    	}, 1000);
      	    },
      		error: function(e)
      		{
      			clearInterval(itv);
      			
      			socket = null;
      			
      			console.error("[TEST] socket error");
      			
      			console.error(e);
      		}
      	});
      	
      	console.log("[TEST] open connection");
      	
      	socket.connect();
      });
       
      win.open();
      
      

        Attachments

          Activity

            People

            • Assignee:
              kiguchi Kota Iguchi (Inactive)
              Reporter:
              sandrolain Sandro Lain
              Reviewer:
              Kota Iguchi (Inactive)
              Tester:
              Abir Mukherjee
            • Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-10347
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration