Bookstore

Recent

Author Topic: How does SimpleIPC works?  (Read 1930 times)

rdny

  • New Member
  • *
  • Posts: 38
How does SimpleIPC works?
« on: December 10, 2018, 07:42:46 am »
How does SimpleIPC works? Can you guys give me a sample codes? I can't find examples that is running/working correctly even in old topics here in forum. Thanks in advance! :D :D

howardpc

  • Hero Member
  • *****
  • Posts: 3356
Re: How does SimpleIPC works?
« Reply #1 on: December 10, 2018, 08:05:11 am »
You can find a good example project (as well as a useful debugging tool) in    ...lazarus/tools/debugserver/debugserver.lpi

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8065
Re: How does SimpleIPC works?
« Reply #2 on: December 10, 2018, 10:23:32 am »
Afaik there are example sources in FPC svn too.

wp

  • Hero Member
  • *****
  • Posts: 6831
Re: How does SimpleIPC works?
« Reply #3 on: December 10, 2018, 12:50:50 pm »
Try attached demo. It shows the essential steps. Compile both programs. Run the server and start it by clicking on the "Start" button. Then run the client and connect it to the server by clicking on the button (an exception will be raised if the server has not yet been started). Once the client is connected you can send messages to the server which will display them in a memo.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

rdny

  • New Member
  • *
  • Posts: 38
Re: How does SimpleIPC works?
« Reply #4 on: December 11, 2018, 02:18:52 am »
Try attached demo. It shows the essential steps. Compile both programs. Run the server and start it by clicking on the "Start" button. Then run the client and connect it to the server by clicking on the button (an exception will be raised if the server has not yet been started). Once the client is connected you can send messages to the server which will display them in a memo.

Thanks guys! Appreciated ;D

One more question, is it possible to send messages in different clients? Like Private messages?
« Last Edit: December 11, 2018, 02:21:28 am by rdny »

lucamar

  • Hero Member
  • *****
  • Posts: 2579
Re: How does SimpleIPC works?
« Reply #5 on: December 11, 2018, 03:22:11 am »
One more question, is it possible to send messages in different clients? Like Private messages?

Yes, it should be possible but you can make sure very easily: open more than one instance of the client and try it :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.6/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

rdny

  • New Member
  • *
  • Posts: 38
Re: How does SimpleIPC works?
« Reply #6 on: December 11, 2018, 03:50:37 am »
Yes, it should be possible but you can make sure very easily: open more than one instance of the client and try it :)
[/quote]

Hi Lucamar! Can you explain in much detailed? Sorry can't get it %)

lucamar

  • Hero Member
  • *****
  • Posts: 2579
Re: How does SimpleIPC works?
« Reply #7 on: December 11, 2018, 04:17:58 am »
Start the server application. Then start the client application. Then start the client application again, so you have two clients. Then test, sending messages to the server from one client or the other.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.6/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

rdny

  • New Member
  • *
  • Posts: 38
Re: How does SimpleIPC works?
« Reply #8 on: December 11, 2018, 07:15:53 am »
Start the server application. Then start the client application. Then start the client application again, so you have two clients. Then test, sending messages to the server from one client or the other.

Oww I see thanks! But why can't I send message in other PC? I try to copy/create shortcut the client app in other system and it doesn't connect in server app in my system? Does it need IP Address? :'(

CCRDude

  • Hero Member
  • *****
  • Posts: 502
Re: How does SimpleIPC works?
« Reply #9 on: December 11, 2018, 09:37:34 am »
IPC means Inter Process Communication. SimpleIPC does use window messages on Windows if I looked it up correctly, so you won't really have a chance of communicating between different machines with it.

There are various different methods of IPC, and even more of communication between computers. A quick to set up way to do it across machines would be simple Synapse or Indy http servers and clients on a custom port to have all layers required for communication already implemented. Or using one of the existing webservice frameworks.

lucamar

  • Hero Member
  • *****
  • Posts: 2579
Re: How does SimpleIPC works?
« Reply #10 on: December 11, 2018, 02:25:48 pm »
Oww I see thanks! But why can't I send message in other PC? I try to copy/create shortcut the client app in other system and it doesn't connect in server app in my system? Does it need IP Address? :'(

Used informally, Inter-Process Communication refers usually to communications between processes in the same machine, while communication between processes in different machines is refered to as networking. SimpleIPC is intended just to easy programming IPC of the first type; for the second type you can start by looking on the wiki page: Networking or the Web Development Portal.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.6/FPC 3.0.4 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

rdny

  • New Member
  • *
  • Posts: 38
Re: How does SimpleIPC works?
« Reply #11 on: December 12, 2018, 08:37:19 am »
Used informally, Inter-Process Communication refers usually to communications between processes in the same machine, while communication between processes in different machines is refered to as networking. SimpleIPC is intended just to easy programming IPC of the first type; for the second type you can start by looking on the wiki page: Networking or the Web Development Portal.
[/quote]

Oww so that's not what I need. Thought it would work. %)

Thank you guys for informations! :D :D