Question about TCP Sockets Profile of DIGI ONE SP

Hi,

Regards,
Tuan

Sorry, I mistakenly post my message without content :smiley:

Please check my questions in the attached figure, I copy them here so that everyone can easily read them:

  1. I don’t want to install RealPort on this PC, instead of that I want to write an application to communicate directly with DIGI ONE SP via TCP/IP, is it possible?

  2. If the answer for question 1 is “Yes” do I have to conform to any specific protocol defined by DIGI?

Regards,
Tuan

Technically, you will find NOT using Realport and using raw TCP Sockets to the Digi One SP’s port 2101 easier since you’ll have tighter control of the timing. Put another way, Realport is ideal if you have an existing application talking out a COM port, but for any new work you’ll have an easier life going direct.

Perhaps someone else can provide an app note link, but all you need to do is:

  1. set up the TCP Sockets serial port profile in the DOSP
  2. I would set the optional “inter-character timeout”, which will return most of the response within 1 TCP segment.
  1. I would also make sure the TCP Keepalive is short
  1. Then your application merely opens a TCP socket to the DOSP on TCP port 2101. Find any “TCP Client” example on the web or book. You should create the FULL request within your application and send as ONE call to socket.send or write. If you send (for example) a Modbus/RTU request as 3 writes to the socket, you cannot prevent timing gaps on the DOSP’s serial port. If you send the full 8-byte request as a single socket write, then the DOSP should receive it as 1 segment and will send all 8 bytes out the serial port. You do NOT need to use any special protocol.

  2. When you receive, keep in mind that the response might return in more than 1 TCP segment - so if the response is 105 bytes, you CANNOT read the socket and expect to see 105 bytes always. Usually you will see 105, but at times you might see only 64 in the first read, and 41 in a second read. So handle this in your program up front and you will have a sweeter experience.

  3. As a side note - besides port 2101, many Digi products (but I do not think the DOSP does) also listen on port 2501 for SSH-encapsulated data and 2601 for SSL. So once your simple TCP application works, you can look at adding encryption with little extra effort.

I have a slightly different question about a Digi One SP and TCP sockets.

I am developing an application to configure a Digi one SP via command line over Telnet. I need it to be a TCP Sockets profile which works in my environment. Using the wizard, configuring TCP Socket is straightforward. However via command line there is a series of things that need to be configured to achieve the net result of selecting the TCP Sockets profile from the wizard.

Can you tell me what parameters are changed in the wizard when selecting TCP sockets so I can mirror those changes from the command line interface?

Thanks.

Bill

TCP Sockets can operate as either a client (outbound socket connection from serial port) or server (inbound socket connection to serial port).

The best way to see what changes are made at the CLI level would be to set a Digi One SP to factory default, then do a backup of the config file (from WebUI > Administration > Backup/Restore).

Once the backup file is obtained, make the serial port profile change to TCP Sockets, configure it for client if desired, as well as any other confuration changes that need to be made to conform to your application, then backup your config file again. Compare the two config files, which are in reality text files, and you have your answer.