Networking?

Monkey Forums/Monkey Programming/Networking?

zoqfotpik(Posted 2013) [#1]
Is there a simple networking solution that compiles on Android? All I need is to get a short string in response to a string. HTTP Get requests do that, do they not? Even if you had to encode the input string as part of the URL, that would be fine...


Midimaster(Posted 2013) [#2]
Search for keywords MNet and HTTP. There have bee some discussion around this last week....


zoqfotpik(Posted 2013) [#3]
Thank you. I basically need to just authenticate, then send a string to the server, then get a result.


bruZard(Posted 2013) [#4]
you can use my module "sedm.utils" > http://www.sedm.de/monkey/sedm.zip

Example:
Strict

Import mojo
Import sedm.utils

Class Game Extends App
	Public
	
	Method OnCreate:Int()
		Self.xhr = New XMLHttpRequest()
		Self.xhr.open("http://sedm.de/pub/ip.php")
		Self.xhr.send()
		
		SetUpdateRate(30)
		Return 0
	End
	
	Method OnUpdate:Int()
		Self.result = Self.xhr.responseText
		Return 0
	End
	
	Method OnRender:Int()
		Cls()
		
		DrawText("sedm says your ip is " + Self.result, 10, 10)
		
		Return 0
	End
	
	
	Private
	
	Field xhr:XMLHttpRequest
	Field result:String
	
End

Function Main:Int()
	New Game()
	Return 0
End



rIKmAN(Posted 2013) [#5]
I get an error when trying to run the example using Monkey v66 and v67.

Error : Type 'XMLHttpRequest' not found

I have copied the sedm folder to the modules directory.