TCP on iPhone device seems strange

Previous topic - Next topic

Kitty Hello

#15
Code (glbasic) Select

LOCAL socket% = -1 // I assume
sinit = SOCK_INIT() // First time run of the program - initialize the socket engine - DON'T DO THAT SOMEWHERE IN BETWEEN - don't make life complicated


... main program ...

IF NOT sinit THEN END // that can't happen. Really - it's always working

// connect to the server thing
socket = SOCK_TCPCONNECT(ip_address$, ip_port, timeout)
IF socket = -1 // Can't connect? Why?
PLAYSOUND (on_error, 0, 0.9)
connected = FALSE
power = FALSE
msg$ = "Failed to connect" + NETGETLASTERROR$(); px = 138 ; py = 152 // Tell us why!
sinit = 0
SOCK_SHUTDOWN
ELSE
    SOCK_SET_BLOCKING socket%, TRUE // set to blocking mode -> wait for each command to return (might help)
    IF SOCK_TCPSEND(socket%, "Yo mama, sockets like rockets") < 0; msg$=NETGETLASTERROR$(); RETURN FALSE; ENDIF
PLAYSOUND (on_connect, 0, 0.9)
connected = TRUE
power = TRUE
msg$ = "Successful connection" ; px = 112 ; py = 152
ENDIF

spicypixel

#16
Yo mama, sockets like rockets PMSL =) Thank you Gernot will adapt my code accordingly

SOCK_SET_BLOCKING is not in my manual here, hmmmm update methinks!
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

spicypixel

SOCK_SETBLOCKING doesn't exist Gernot????? :O
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Kitty Hello

get the beta version (android thread) and unzip the hotfix for it afterwards.
The manual is the online help that should show it.

spicypixel

I have now tried my app on an iPad and it works flawlessly with both 3G and WiFi connecting when it should and failing when it should. I can only presume on my JB'd iPhone that it has some internal firewall or proxy that re-routes the connections thus allowing the connection to be accepted internally and consequently my app saying "connected" but then obviously re-routing the connection nowhere because it can't unless of course I enter the correct IP and Port in which case the connnected message is indeed correct.

Like I have always said my app works on my JB'd phone too and connects flawlessy if the correct IP:Port is given and performs the commands successfully to the server my only problem was that it say "connected" pretty much regardless of IP:Port (apart from things like 255.255.255.255:port etc..)

I did send a message Gernot to see if you wouldn't mind trying the app of mine on your device to see if it is a JB issue with certain JB'd phones (mine is a white US iPhone 3GS) but I guess you are busy no problem mate and thank you for the help already. =)

http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.