Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

TCPSocketProxy as input argument in module

$
0
0

I am writing my own (android) module and I wanted to pass an initialised TCPSocket to my module, but I don't know how to do this. I was thinking as follows:

In js, the usage of the module:

var tcpSocket = Ti.Network.Socket.createTCP({
    host: Ti.Platform.address, 
    port: 40401,
    connected: function (e) {...},
    error: function (e) {...}
});
 
var myService = myModule.createService();
 
myService.setSocket(tcpSocket);
and in the java module myModule:
@Kroll.proxy(creatableInModule=myModule.class)
public class ServiceProxy extends KrollProxy{
 
    @Kroll.method
    @Kroll.setProperty
    public void setSocket(TCPSocketProxy socket) {
        this.socket = socket;
    }
}
Does anybody know how to do this? Is it allowed to use native objects from titanium in your own module?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>