Reading TCP packets in Omnis

jim jpcr.com jim at jpcr.com
Wed Feb 28 18:52:47 UTC 2024


Hi Jef,

This doesn’t appear to be quite what I am trying to do.  I am not using a Modbus device.  I have a serial-wifi interface that sends out a TCP packet to an IP:port address, so I am looking for Omnis code that is running on the IP and listening on the port.  When a packet comes in I need to save it and then go right back to listening for the next packet.

Can you (or anyone else) send a a code sample that does this?

Thanks in advance,

Jim

--
Jim Pistrang
JP Computer Resources
413-237-5710
<https://jpcr.com>

On Feb 28, 2024, at 10:12 AM, Jef Leys | Desim <jef.leys at desim.be> wrote:

Hi,

Some sample code that works.


TCPConnect (FGebouw.GCadisIP,502) Returns socketUit
If flag true

Calculate binBuffer as binfromhex(FullString)
TCPSend (socketUit,binBuffer) Returns return
If flag true

TCPReceive (socketUit,buffer) Returns AntwoordLengte
If flag true

Calculate Antwoord as bintohex(buffer)
End If
End If
End If
TCPClose (socketUit)


Jef Leys

Op 28 feb. 2024, om 16:09 heeft jim jpcr.com <jim at jpcr.com> het volgende geschreven:

Hi $List,

I’m struggling to read incoming TCP packets in Omnis.  I’ve attempted to write code using the various TCP commands, but with no success (and much head banging).

Does anyone have some sample code they can send me?

My code needs to listen for a packet on a specific port, and when it comes in it will call a method to write packet data to a database table and then go back to listening.

Thanks,

Jim



--
Jim Pistrang
JP Computer Resources
413-237-5710
<https://jpcr.com>

_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com

_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list