Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local client = luasocket.TCPClient()
- local header =
- F("GET /%s HTTP/1.1\n", "") ..
- F("Host: %s\n", "www.google.no") ..
- "User-Agent: oohh\n" ..
- "\n"
- client:Connect("www.google.com", 80)
- client:Send(header)
- function client:OnConnect(ip, port)
- printf("%s connected to %s:%s", self, ip, port)
- end
- function client:OnSend(data)
- printf("%s sucessfully sent %q", self, data)
- end
- function client:OnReceive(line)
- printf("%s received %q", self, line)
- end
- function client:OnClose()
- printf("%s wants to close", self)
- self:Remove()
- end
Advertisement
Add Comment
Please, Sign In to add comment