This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Check connected tcp ports
#1
Hello

do somebody know:
- how can I check currently connected tcp ports?
- how can I reach the socket which is created and permanent used in resident script via event script?

The solution is necessary for Sony Bravia TV. I must have permanent tcp connection to have ability to read status when TV is off. So for this solution I've prepared the resident script 0s:
Code:
require('socket') if not sock_bravia then -- bravia IP ip = '192.168.2.102' sock_bravia = socket.tcp() sock_bravia:settimeout(3) res, err = sock_bravia:connect(ip, 20060) end -- power-status cmd = '*SEPOWR################\n' -- Check status power if res then  res, err = sock_bravia:send(cmd)  if res then    res, err = sock_bravia:receive()    if res then      log('receive OK: ' .. tostring(res)) -- received ok    else      log('receive failed: ' .. tostring(err)) -- receive failed    end  else    log('send failed: ' .. tostring(err)) -- send failed  end else  log('connect failed: ' .. tostring(err)) -- connect failed end os.sleep(5)

But sometimes I want send command e.g. switch on but from event-based script. How can I reach currently port from other script?
Reply


Messages In This Thread
Check connected tcp ports - by buuuudzik - 22.06.2017, 12:24
RE: Check connected tcp ports - by admin - 22.06.2017, 12:32
RE: Check connected tcp ports - by mlaudren - 23.06.2017, 12:27
RE: Check connected tcp ports - by buuuudzik - 23.06.2017, 14:12
RE: Check connected tcp ports - by mlaudren - 23.06.2017, 14:37
RE: Check connected tcp ports - by buuuudzik - 23.06.2017, 14:51
RE: Check connected tcp ports - by admin - 23.06.2017, 17:29
RE: Check connected tcp ports - by rocfusion - 25.06.2017, 21:50

Forum Jump: