CapsAdmin

Untitled

Mar 14th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local client = luasocket.TCPClient()
  2.  
  3. local header =
  4.     F("GET /%s HTTP/1.1\n", "") ..
  5.     F("Host: %s\n", "www.google.no") ..
  6.     "User-Agent: oohh\n" ..
  7.     "\n"
  8.  
  9. client:Connect("www.google.com", 80)
  10. client:Send(header)
  11.  
  12. function client:OnConnect(ip, port)
  13.     printf("%s connected to %s:%s", self, ip, port)
  14. end
  15.  
  16. function client:OnSend(data)
  17.     printf("%s sucessfully sent %q", self, data)
  18. end
  19.  
  20. function client:OnReceive(line)
  21.     printf("%s received %q", self, line)
  22. end
  23.  
  24. function client:OnClose()
  25.     printf("%s wants to close", self)
  26.     self:Remove()
  27. end
Advertisement
Add Comment
Please, Sign In to add comment