NetTalk Central

Author Topic: How to send data service to program  (Read 1641 times)

jlavera

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Email
How to send data service to program
« on: June 08, 2020, 07:58:29 AM »
Hi, looking for orientation.
I need a sample of pure CODE only (no controls, no windows objects) that can send a small packet of data, between a service and an exe program, both in the same machine, both Clarion 10, latest netTalk. The service is controlled by SelfService. Both the service and the exe are NOT webservers, they are just regular simple source programs using nettalk and selfservice general extensions.
There are so many options that I don't where to start looking. I'd need it simple if possible... no internet or port access needed, both program and service always runs on the same machine.

Thanks,
Jorge Lavera

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11171
    • View Profile
Re: How to send data service to program
« Reply #1 on: June 10, 2020, 07:35:27 PM »
Hi Jorge,

>> (no controls, no windows objects)

you will need a window (perhaps a hidden window) because NetTalk TCP/IP is asynchronous.
I'm not sure what you have against windows <g> but they're a necessary part here.

As to the code, it's simple enough, and a good place to start is the NetTalk Object extension.
Put this on the window at both ends; one as a NetSimple class, set as a server, (probably on the service side) and one as a NetSimple class, set as a client on the other side.

On the server side you would set the port to listen on as say 1088

To send from the client you will use;
The client will connect to the server;
  net.open('127.0.0.1','1088') ! connect to say port 1088

  self.send('whatever')

On the server side incoming requests come into the .process method. And you can process them there.

On the client side the same.

If you come to the user group webinar and ask a question I can walk through this with you.

cheers
Bruce