Advertisement
fuxoft

Trying to communicate with beanstalkd

Sep 29th, 2018
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. #!/usr/bin/env luajit
  2.  
  3. local fn = "/tmp/ffsock"
  4. --Trying to connect to running beanstalkd
  5. os.execute("socat -d -d -d pty,link="..fn..",raw  tcp:localhost:11300")
  6. os.execute("sleep 1")
  7. local writer = io.open(fn,"w")
  8. local reader = io.open(fn,"r")
  9. writer:write("invalidcommand\r\n")
  10. writer:flush()
  11. local txt = reader:read("*l")
  12. print("Got response: "..txt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement