facebook

socket (UDP/TCP) based application

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #320218 Reply

    sam, shamsul
    Member

    This message has not been recovered.

    #320235

    support-michael
    Keymaster

    This message has not been recovered.

    #320238

    sam, shamsul
    Member

    This message has not been recovered.

    #320276

    support-michael
    Keymaster

    This message has not been recovered.

    #320281

    sam, shamsul
    Member

    This message has not been recovered.

    #331523

    esmadja
    Member

    Trying to revive this topic.

    Im am trying to send the following

    var net = require(‘net’);
    var HOST = ‘127.0.0.1’;
    var PORT = 6969;
    var client = new net.Socket();
    client.connect(PORT, HOST, function() { console.log(‘CONNECTED TO: ‘ + HOST + ‘:’ + PORT);
    // Write a message to the socket as soon as the client is connected, the server will receive it as message from the client
    client.write(‘This is a test!’);});

    In order to do this you need node.js

    So is there a way to add node.js I have tried to add all the .js files required however one of the line in many of these files are the equivalent of an include i.e. var net = require(‘net’);
    and require is not being recognized by mobione

    Alternatively is there an other method to do this, such as web sockets?

    Anyone have a sample example using websockets?

    Thanks,

    #331545

    support-michael
    Keymaster

    Can you provide a more context to how your app needs to communicate?

    Is it synchronous request/reply? That is the client opens connection and makes a request, the server replies immediately or soon there after.

    Will connection remain open for long period such as waiting for the the server send async events?

    Will simple http post or get do job?

    Web Sockets are not implemented by the Test Center emulator.

    #331808

    esmadja
    Member

    Yes it is a simple sync request reply. Unfortunately an http post will Not get the job done.
    I need to be able to send a string to a listening server on a specific port.

    #331874

    support-michael
    Keymaster

    @esmadja

    >I need to be able to send a string to a listening server on a specific port.

    Clear! You’ve already mentioned this but I will return to propose using HTML5 websockets or server-sent events as they are available on iOS 5+ (see http://caniuse.com/#feat=websockets). The Test Center emulator does not support websockets yet. On your desktop you can test/debug using Chrome or Safari and the webkit inspector.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: socket (UDP/TCP) based application

You must be logged in to post in the forum log in