Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentetsu authored Nov 4, 2024
1 parent ca79f35 commit 3f4b10c
Showing 1 changed file with 2 additions and 69 deletions.
71 changes: 2 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,8 @@ Python shared memory library based an posix-ipc.
$> pip install SharedMemory
```

### Example
Example of execution in two instances of ipython.

#### Client side
```python
In [1]: from SharedMemory import SharedMemory

In [2]: # Creating client instance with a shared space named 'shared_space' with a size of 10
...: C = SharedMemory(name="shared_space", value="Hello", client=True)

In [4]: C.getAvailability()
Out[4]: True

In [5]: C.getValue()
Out[5]: 'Hello'

In [6]: # Waiting for Server to update shared data

In [7]: C.getValue()
Out[7]: 'World'

In [8]: C.setValue('HW')
Out[8]: True

In [9]: C.getValue()
Out[9]: 'HW'

In [10]: # Closing the client side
...: C.close()

In [11]: C.getAvailability()
Out[11]: False
```
#### Server side
```python
In [1]: from SharedMemory import SharedMemory

In [2]: # Creating server instance access to the shared named 'shared_space'
...: S = SharedMemory(name="shared_space", client=False)

In [4]: S.getAvailability()
Out[4]: True

In [5]: S.getValue()
Out[5]: 'Hello'

In [6]: S.setValue("World")
Out[6]: True

In [7]: S.getValue()
Out[7]: 'Hello'

In [8]: # Waiting for Client to update shared data

In [9]: S.getValue()
Out[9]: 'HW'

In [10]: # Waiting Client to close the shared space

In [11]: S.getAvailability()
Out[11]: False


In [12]: # Closing the server side
...: S.close()
INFO: Client already stopped.
```


### Documentation
Documentation and example are provided [here]([https://github.com/Zentetsu/RoboticHand](https://github.com/Zentetsu/SharedMemory/wiki))

### More
[![PyPI version](https://badge.fury.io/py/SharedMemory.svg)](https://badge.fury.io/py/SharedMemory)
Expand Down

0 comments on commit 3f4b10c

Please sign in to comment.