NetTalk Central

Author Topic: IoT device  (Read 4303 times)

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
IoT device
« on: September 09, 2020, 05:45:35 AM »
I have request to read and send data to IoT device. There is no classic connection, just IP and Port and sending and receiving packets are randomly initiated.
What option for that kind of communication is the best in NetTalk tools? Server, client, neither?

How to achieve this kind of communication?

Best regards,

Djordje

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: IoT device
« Reply #1 on: September 09, 2020, 05:10:12 PM »
Hi Djordje,

I worked on something similar, although it was "receiving" packets (a NetSimple UDPServer object was the starting point, listening on a specific port).

So I'd say look up the docs on the NetSimple client functionality, and check out the examples.

https://capesoft.com/docs/NetTalk11/nettalk3.htm#How_to_use_NetSimple_as_a_Client_or_a_Server

Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: IoT device
« Reply #2 on: September 09, 2020, 09:22:06 PM »
Hi Djordje,

yes, the connection you are looking for is called NetSimple. eg

Add this to a window using the "Add NetTalk Object" template, and set the Class name to
NetSimple

If the device is TCP based then you are likely going to be the Client in the conversation.
(ie you open the connection)

If the device is UDP based, then you will be a UDP "server" listening on the prescribed port.

cheers
Bruce



Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: IoT device
« Reply #3 on: September 18, 2020, 01:50:26 AM »
Thanks Stu and Bruce I'll give a try to UDP communication although I am not sure that this is UDP communication. When I look in documentation UDP is not mention. In my application I am using NetSimple as a client. It works but with various success.

Sending is by default with no error. Device receive what I send. But receiving is mostly with errors "Connection closed by Remote Machine"

Regards,

Djole

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: IoT device
« Reply #4 on: September 21, 2020, 10:42:14 PM »
Hi Djordje,

If it doesn't say UDP it's not likely to be be UDP.

>> Sending is by default with no error. Device receive what I send.

>> But receiving is mostly with errors "Connection closed by Remote Machine"

What errors? the remote device can of course close the connection at any time it likes. That's pretty normal, and pretty standard.

The real fun when talking to IoT devices is of course speaking their language correctly. You have to send strings they specifically understand, and you have to properly interpret the results they send to you.

cheers
Bruce