As the title says... Chat on...

User avatar
By alonewolfx2
#3631 i am trying your code but i have a problem with eof :S how i can figure this?

Code: Select alldofile("dnstest.lua")
lua: dnstest.lua:14: '<eof>' expected near 'end'
User avatar
By alonewolfx2
#3632 its working for me. i am getting right result.

Code: Select allmyhost="api.whatismyip.com"
> mypage=""
> myip=""
> sk=net.createConnection(net.TCP, 0)
> sk:dns(myhost,function(conn,ip)
>> myip=ip
>> sk=net.createConnection(net.TCP, 0)
>> sk:on("receive", function(sck, c) print(c) end )
>> sk:connect(80,myip)
>> sk:send("GET / " .. mypage .." HTTP/1.1\r\nHost: " .. myhost .."\r\n\r\n")
>> end)
> HTTP/1.1 403 Forbidden
Server: nginx
Date: Sun, 30 Nov 2014 18:40:05 GMT
Content-Type: text/html; charset=iso-8859-1
Content-Length: 10
Connection: keep-alive
Vary: Accept-Encoding

Forbidden.