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.

Data buffering
#7
I checked this and the problem is not in UDP client-server. It works great but when I try send the command via TCP my connection is refused. I try to send cmd to the RS485 server. This is the script:

Code:
if not server then
 -- local UDP server on port 5432
 server = require('socket').udp()
 server:settimeout(1)
 server:setsockname('127.0.0.1', 5432)
 
 -- serial connection
 port = require('serial').open('/dev/RS485', {
   baudrate = 4800,
   parity = 'odd',
   duplex = 'half',
   databits = 8,
   stopbits = 1
 })
end

cmd = server:receive()

if cmd then
function somfy_rf(cmd)
serial_server_ip = '192.168.2.15'
host, port = serial_server_ip, 10001
socket = require("socket")
client = socket.tcp()
client:settimeout(1)
client:connect(host, port)
client:send(cmd)
end
 somfy_rf(cmd)
 if #cmd == 12 then
   time = 6
 elseif #cmd == 13 then
   time = 0.6
 elseif msg == set_channel then
   time = 0.45
 end
 os.sleep(time)
end
Where is the error?

This is the network configuration of the serial server.

Attached Files Thumbnail(s)
       
Reply


Messages In This Thread
Data buffering - by buuuudzik - 22.09.2016, 19:19
RE: Data buffering - by admin - 22.09.2016, 19:50
RE: Data buffering - by admin - 23.09.2016, 06:47
RE: Data buffering - by buuuudzik - 23.09.2016, 07:20
RE: Data buffering - by buuuudzik - 30.09.2016, 09:19
RE: Data buffering - by admin - 30.09.2016, 10:15
RE: Data buffering - by buuuudzik - 30.09.2016, 10:39
RE: Data buffering - by admin - 30.09.2016, 11:02
RE: Data buffering - by buuuudzik - 30.09.2016, 11:30
RE: Data buffering - by admin - 30.09.2016, 12:12
RE: Data buffering - by buuuudzik - 30.09.2016, 13:04

Forum Jump: