GLBasic forum

Main forum => GLBasic - en => Topic started by: msx on 2017-Jan-09

Title: Socket works on iOS?
Post by: msx on 2017-Jan-09
My app uses sockets and works perfectly on Android and Windows, however it does not connect on iOs. A simple function like the following...

Code (glbasic) Select
FUNCTION CompruebaINET:
// Comprobamos conexión, 1=Si
LOCAL bInternet=0, sock%
SOCK_INIT()
sock% = SOCK_TCPCONNECT("www.google.com", 80)
IF sock%>=0 THEN bInternet=TRUE // check return value. Is it 0 or -1 on error?
SOCK_CLOSE(sock%)
SOCK_SHUTDOWN
RETURN bInternet
ENDFUNCTION


... always responds 0.

Socket not yet implemented in iOS?.
Title: Re: Socket works on iOS?
Post by: mentalthink on 2017-Jan-10
Pérdona que me meta en el hilo MSX (es que ando con esto de los sockets con un NodeMCU controlando un servo por WIFI), el asunto es que tengo que enviar muchos valores... Tengo que abrir y cerrar el socket cada vez que envío un valor?¿, o puedo dejar el socket abierto y cerrarlo después de haber enviado lo que me interese... No se si me explico.

El asunto me funciona, aunque tarda unos segundos en responder el servo (Supongo que puede ser que la señal va al router y vuelve al MCU, o que estoy haciendo algo mal).

Saludos.
Title: Re: Socket works on iOS?
Post by: msx on 2017-Jan-10
Quote from: mentalthink on 2017-Jan-10
Pérdona que me meta en el hilo MSX (es que ando con esto de los sockets con un NodeMCU controlando un servo por WIFI), el asunto es que tengo que enviar muchos valores... Tengo que abrir y cerrar el socket cada vez que envío un valor?¿, o puedo dejar el socket abierto y cerrarlo después de haber enviado lo que me interese... No se si me explico.

El asunto me funciona, aunque tarda unos segundos en responder el servo (Supongo que puede ser que la señal va al router y vuelve al MCU, o que estoy haciendo algo mal).

Saludos.

No hace falta. Una vez que te asigna un socket con el comando SOCK_TCPCONNECT ya usas siempre el mismo, no hace falta cerrarlo, de hecho puedes abrir más y cada uno tendrá un Socket diferente. Ese valor es el que vas a usar en los sucesivos SOCK_TCPSEND. Si no esperas respuesta del NodeMCU tan solo necesitará este último comando, de lo contrario por cada envio tendrás que recibir respuesta por SOCK_RECV.
Title: Re: Socket works on iOS?
Post by: spacefractal on 2017-Jan-10
please in English, thanks.

There is nothing im can do can testing in this case, because im does nothing know how sockets really works. Also somewhere in the future, Apple might even block it, its not sent via https. But the deadlead, which was last two week, got delayed with no new date. So im guess, very few apps really do that.

That understand, because not all kind of apps would require https at all.
Title: Re: Socket works on iOS?
Post by: mentalthink on 2017-Jan-10
Thanks MSX.
Sorry spacefractal (I comment to msx another question), Basically I ask about open and close the socket each time I send something to a NodeMCU(Is a device like Arduino, but WIFI).

The first question in the post done for MSX is the main question.

Sorry for change the lenguaje.  :booze:   :x
Title: Re: Socket works on iOS?
Post by: msx on 2017-Jan-10
Quote from: spacefractal on 2017-Jan-10
please in English, thanks.

There is nothing im can do can testing in this case, because im does nothing know how sockets really works. Also somewhere in the future, Apple might even block it, its not sent via https. But the deadlead, which was last two week, got delayed with no new date. So im guess, very few apps really do that.

That understand, because not all kind of apps would require https at all.

Apologise me too.

I'm sorry you can not help me. I hope Gernot knows more about it and can solve it.