weixin_39564368
weixin_39564368
2020-12-02 11:21

implemented connectUDP() to fix #306

I've added tests and implementation for udpport and created the necessary wrapper function connectUDP(). I have done only very basic live testing against a Wago 750-880 plc but it seems to work.

该提问来源于开源项目:yaacov/node-modbus-serial

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

10条回答

  • weixin_39637397 weixin_39637397 5月前

    fixes #306

    点赞 评论 复制链接分享
  • weixin_39564368 weixin_39564368 5月前

    I'll let you know how I get on. A couple of other things:

    1. It would be nice to extract the buffer parse/creation functions in udpport and tcpport somewhere common since they repeat each other
    2. I noticed there is a listen() method on the dgram mock which does not exist on the real dgram object. I added bind() since this does exist and was necessary for my implementation
    3. I'm curious how the C701 port works since it doesn't call bind() on the dgram socket.
    点赞 评论 复制链接分享
  • weixin_39637397 weixin_39637397 5月前

    It would be nice to extract the buffer parse/creation functions in udpport and tcpport somewhere common since they repeat each other

    You are welcome to re-factor ( carefully :-) )

    I noticed there is a listen() method on the dgram mock which does not exist on the real dgram object. I added bind() since this does exist and was necessary for my implementation

    ?! hmm ... if it needs a missing method how does it work with real dgram object ?

    点赞 评论 复制链接分享
  • weixin_39564368 weixin_39564368 5月前

    ?! hmm ... if it needs a missing method how does it work with real dgram object ?

    listen() doesn't get called from the C701 implementation (nor does bind()). I think it may have been some copy-paste from the TCP mock. Having said that, I can't see how the C701 implementation works without calling bind().

    点赞 评论 复制链接分享
  • weixin_39637397 weixin_39637397 5月前

    I do not have a C701 machine to test in real life .. I need to trust the tests, passing the tests, as they were written when the port was tested with real hardware, is the best thing I can do for now.

    点赞 评论 复制链接分享
  • weixin_39816448 weixin_39816448 5月前

    sirockin: thanks for testing on a WAGO PLC. yaacov: may I ask what machine use the C701 protocol ? also when this UDP could be published on npm ? I need to ask another repo who use your npm to add the udp.

    点赞 评论 复制链接分享
  • weixin_39637397 weixin_39637397 5月前

    hi,

    also when this UDP could be published on npm ?

    Happy new release :balloon: :gift: https://github.com/yaacov/node-modbus-serial/releases/tag/v7.8.0

    点赞 评论 复制链接分享
  • weixin_39564368 weixin_39564368 5月前

    yaacov: may I ask what machine use the C701 protocol ?

    The comment at the head of c701port.js reads 'Simulate a modbus-RTU port using C701 UDP-to-Serial bridge' so I presume it's some kind of ethernet/serial converter.

    点赞 评论 复制链接分享
  • weixin_39637397 weixin_39637397 5月前

    The comment at the head of c701port.js reads 'Simulate a modbus-RTU port using C701 UDP-to-Serial bridge' so I presume it's some kind of ethernet/serial converter.

    Yes, it's a mutli protocol converter, It's a proprietary device usually sold with it's own proprietary client , the code here is reversed engineered ... I want to keep the option to support if :-)

    点赞 评论 复制链接分享
  • weixin_39637397 weixin_39637397 5月前

    Thanks :heart:

    have no way to test it :-) have fun.

    点赞 评论 复制链接分享

相关推荐