@春哥 好~
connected:setpeername('*')
unconnected:setpeername(address, port)
Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the send and receive methods instead of sendto and receivefrom.
Address can be an IP address or a host name. Port is the port number. If address is '*' and the object is connected, the peer association is removed and the object becomes an unconnected object again. In that case, the port argument is ignored.
In case of error the method returns nil followed by an error message. In case of success, the method returns 1.
Note: Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
是否可以这么处理:
1、 rewrite_by_lua*, access_by_lua* 阶段,通过ngx.udp(),setpeername('/tmp/udp.sock') 实现共享udp连接?
2、result in up to 30% performance 30%的性能提升,是这种处理方式么?
多谢~!