0

there's this problem i am working with but since i am a bit new on linux and also programming in C, it would be a great help improving my skills if somebody could help me with this problem.

I'm practicing using Linux, so i got into this problem after I was studying about it and it got stuck into my mind since i can't barely find a solution.

The problem was: Creating a program for process communication (client-server) using Shared Memory, and also use shm_lock, shm_unlock, ipc_stat, ipc_set, ipc_rmid

I only know the client-server communication, by that i mean that te server sending a string to the clinet and the client letting him know that it got the message.

I really hope somebody helps me or redirects me to some page where i can find or read more about this problem/solution.

THANKS!

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
Abigal
  • 39
  • 1
  • 6
  • 3
    This is a bit too general. Please try to code something yourself and ask again (providing this code) if it doesn't work.For a primer: http://www.tldp.org/LDP/lpg/node21.html – Ctx Jan 14 '16 at 09:30
  • 1
    You can read more in your terminal, actually, by typing `man shm_lock` – V. Kravchenko Jan 14 '16 at 09:47
  • @Ctx - the thing is i just need to write that program using those properties, so that two processes can communicate using shared memory (client-server) – Abigal Jan 14 '16 at 10:04
  • So do it! What is your actual problem? `shmget()` creates shared memory and returns its *id*. `shmat()` attaches the shared memory segment to the address space of the calling process and returns segment's start address. `shmdt()` detaches shared memory. If you have still problem, you can refer to this [SO question](http://stackoverflow.com/questions/5656530/how-to-use-shared-memory-with-linux-in-c) (see [linked examples](http://www.cs.cf.ac.uk/Dave/C/node27.html)). – patryk.beza Jan 14 '16 at 23:42
  • @patryk.beza , thanks a lot mate, u kinda motivated me! I would like to keep in touch, any email or somewhere I can contact you?! Or I simply share my facebook account link? (ps. this ain't my real name haha) – Abigal Jan 15 '16 at 02:16

0 Answers0