Recent

Author Topic: SimpleIPC example  (Read 14095 times)

mercury

  • Full Member
  • ***
  • Posts: 154
SimpleIPC example
« on: October 24, 2015, 04:37:06 am »
I want two programs exchange information use SimpleIPC. Or other way but not socket.
But I don't know how to start, google around and found not thing I want.
So, please give me a SimpleIPC example. Thanks.

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: SimpleIPC example
« Reply #1 on: October 24, 2015, 09:11:28 am »
put TSimpleIPCServer component in the form of one program and TSimpleIPCClient compnent in the other.
set ServerID string to be in both program
for example '66666'
use the SendMessage to send message
you will receive massage in onmessage event

mercury

  • Full Member
  • ***
  • Posts: 154
Re: SimpleIPC example
« Reply #2 on: October 24, 2015, 09:18:39 am »
put TSimpleIPCServer component in the form of one program and TSimpleIPCClient compnent in the other.
set ServerID string to be in both program
for example '66666'
use the SendMessage to send message
you will receive massage in onmessage event

I tried, that is not working.
It says "this operation is illegal when server is inactive".
"IPCServer.StartServer;" seems no effect.

And nowhere explain about IPCServer.Global , what this use for?

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: SimpleIPC example
« Reply #3 on: October 24, 2015, 09:47:46 am »
the doc say  IPCServer.Global allow other process to connect to the server ,so it should be True.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: SimpleIPC example
« Reply #4 on: October 24, 2015, 09:53:16 am »
the doc say  IPCServer.Global allow other process to connect to the server ,so it should be True.
No matter set it True or False, it never working.

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: SimpleIPC example
« Reply #5 on: October 24, 2015, 10:02:08 am »
this is an example.

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: SimpleIPC example
« Reply #6 on: October 24, 2015, 10:11:35 am »
set the IPCServer.Global to true before compiling the project.
this is one app run it twice in one click start server
in the second click connect client
in the client click send message.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: SimpleIPC example
« Reply #7 on: October 24, 2015, 04:48:32 pm »
this is an example.
Your example is working.
Thank you very much.

Now I know where is wrong.
I put "IPCServer.StartServer;" in "TForm1.FormShow".
This is some oddness, no warning no error. Just no effect.

How can I let IPCServer start without click a button?


z505

  • New Member
  • *
  • Posts: 38
  • think first, code after
Re: SimpleIPC example
« Reply #8 on: May 08, 2017, 09:33:30 am »
this is an example.

I could not get the example in your zip file to work in Lazarus 1.6

I will try it in the latest version of lazarus as my 1.6 may be old, but it should work?

Started two separate exe's with the same name and it gives me an exception, server not active. On MS Windows.

(sorry reviving an old thread -- me the thread necromancer)
think first, code after

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: SimpleIPC example
« Reply #9 on: August 23, 2017, 07:41:31 pm »
this is an example.

I could not get the example in your zip file to work in Lazarus 1.6

I will try it in the latest version of lazarus as my 1.6 may be old, but it should work?

Started two separate exe's with the same name and it gives me an exception, server not active. On MS Windows.

(sorry reviving an old thread -- me the thread necromancer)

Any joy with this Z505 ?
All I get is it listing in one memo and not the other.
Also on 1.6 Win 7

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: SimpleIPC example
« Reply #10 on: August 23, 2017, 07:54:32 pm »
Note that there were a bunch of issues related to (simple)IPC listed in mantis e.g. you might perhaps have better luck trying with trunk.

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: SimpleIPC example
« Reply #11 on: August 24, 2017, 12:27:56 am »
this is an example.

I could not get the example in your zip file to work in Lazarus 1.6

I will try it in the latest version of lazarus as my 1.6 may be old, but it should work?

Started two separate exe's with the same name and it gives me an exception, server not active. On MS Windows.

(sorry reviving an old thread -- me the thread necromancer)
yes :( ,I could not get it run in lazarus 1.8 rc4 32 bit , windows 7 64.
it was working in older version, i don't remember( may be 1.4).

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: SimpleIPC example
« Reply #12 on: August 25, 2017, 02:03:44 pm »
@jamie
the client failed to connect.
what i did.
1-start instance of the example program and and press start server.
2-start another instance of the program and press start client.
3-send message from client to server.
   the program failed in step 2 and give this exception:
SimpleIPCClient1: Server with ID 5454847 is not active. 
this may be a bug(regression).

Almir Lima

  • New Member
  • *
  • Posts: 36
    • iSoft Tecnlogia Digital
Re: SimpleIPC example
« Reply #13 on: February 16, 2018, 09:55:20 am »
I have same problem, the server start without error but the client no connect in server, show the same message of error.
=(
Today better than yesterday.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: SimpleIPC example
« Reply #14 on: March 07, 2018, 10:52:09 am »
You must set the server's "Global" to true. Regarding Global=false", the fcl help is a bit confusing here:
Quote
Global indicates whether the server is reachable to all users (True) or if it is private to the current process (False). In the latter case, the unique channel endpoint identification may change: a unique identification of the current process is appended to the ServerID name.
...
InstanceID is the unique identifier for this server communication channel endpoint, and will be appended to the ServerID property to form the unique server endpoint which a client should use.
And after sending a message, the server must call "PeekMessage" and "ReadMessage" (or have an OnReadmessage event handler) - this is what "Button4" does.

 

TinyPortal © 2005-2018