As the title says... Chat on...

User avatar
By little.yoda
#50452 Hi

I have a device there I have to send an Request via UDP and get a Response back to the sending UDP Port.

Currently, I'm using this code for sending the udp packets.

Code: Select all               
cu=net.createConnection(net.UDP,0)
cu:connect(21105,"192.168.0.111") 
cu:send(string.char(0x08 ,0x00 ,0x50 ,0x00 ,0x01 ,0x00, 0x01, 0x00))
cu:close();   


I checked the packets with wireshark and the UDP-Source Port generated by this code seems to be random.
But without knowing the Source Port, I cannot start the necessary receiver to catch the response.

My Questions:
- Is it possible to set the source port for UDP Packets?
- If not, is it possible to get at least an information what UDP-Source Port was used?


Code: Select allNodeMCU custom build by frightanic.com
        branch: master
        commit: b580bfe79e6e73020c2bd7cd92a6afe01a8bc867
        SSL: false
        modules: file,gpio,net,node,tmr,uart,wifi
 build  built on: 2016-07-02 18:29
 powered by Lua 5.1.4 on SDK 1.5.1(e67da894)