Program which I am trying to make like this
There are three GO Porgram, they are Go program 1, Go Program 2 , Go Program 3
Go Program 1 Which get data from serial port and sent to Go Program 2
GO Program 2 Recv. the data from Go program 1 and sent it to MQTT
GO Program 3 It should be web framework as I need Web UI to control and manage these GO program 1 & Go Program 2
The Go Program 3 task are:
To start stop the GO Program 1 & 2
To change or set the COM port of Go Program 1 and publish topics
To change the broker address ,username & Password of Go Program 2
How to make communicate or Pipes between all the the three GO Programs.
Looking at the discussion in comments I think you make an assumption that Go has some special way for IPC that Python doesn't; that's not exactly true. Channels are useful for communication within a single process. If you want these programs to be truly separate (processes) you'll need all the usual IPC - you can use pipes, or sockets, or shared memory, or what have you.
Personally I'd recommend using sockets, because Go is really well suited for network programming and writing socket servers and clients. Also, once your application uses sockets it's much easier to port these different processes to run on multiple machines, across the internet, etc. In addition you can then leverage higher-level protocol levels and use things like RPCs.
To create a socket server, use
net.Listen
, and callAccept
in a loop on the returned object. Each connection returned byAccept
is a remote client you can communicate with - I'd recommend a goroutine here if you want concurrency between multiple clients.For a first cut in a project like yours, however, I'd go for the
net/rpc
package which is very simple to use and gives a much higher level API to sending remote commands to other processes.