serversock


Nameserversock JSON
Version 0.1 PyPI version JSON
download
home_pageNone
Summarycreate multi-client server using multi-threading
upload_time2024-03-29 16:07:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Soumyo Deep Gupta Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords d33pster serversock socket-server socket multiclient server multiple-client
VCS
bugtrack_url
requirements optioner colorama
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Overview
serversock is a python module to create a server that can accept connection from multiple clients at the same time using multithreading.

## Installation
serversock is listed in pypi so the installation is very simple

```bash
# in your terminal/CMD run

pip install serversock
```

## Usage

### Creating server

```python
# import package
from serversock.serversock import _server

# create class object
serverCTRL = _server(address, port, bufffsize)
```

The arguments of _server are defined below as

```python
class _server:
    def __init__(self, address:str, port: int, buffsize:int = 1024):
        """_server initialization

        Args:
            address (str): Enter Address like '0.0.0.0'
            port (int): Enter port number, example: 8080
            buffsize (int, optional): message buffsize. Defaults to 1024.
        """
        ...
    ...
```

After class object creation, start server
```python
# start server

serverCTRL._start(serverfilename, responses)
```

The arguments of _start are defined below as:
```python
class _server:
    ...
    def _start(self, serverfilename:str, responses:int = 1):
        """start server

        Args:
            serverfilename (str): serverfilename to save server data
            responses (int, optional): Number of response expected from client. Defaults to 1.
        """
        ...
    ...
```

### Creating clients
```python
# import _client class from serversock

from serversock.serversock import _client

# create class object
clientCTRL = _client(serveraddress, serverport, serverbufflimit)
```
The arguments of _client are defined below as:
```python
class _client:
    def __init__(self, serveraddress:str, serverport:int, serverbufflimit:int = 1024):
        """_client class initialization

        Args:
            serveraddress (str): server address like '0.0.0.0'
            serverport (int): server port like 8080
            serverbufflimit (int, optional): buffersize. Defaults to 1024.
        """
        ...
    ...
```

After that client can perform a bunch of tasks like send a message, sync with the server and disconnect voluntarily.

- send message and get response in return
    - client can send message to the server that the server will save.

    ```python
    # send message
    clientCTRL._sendToServer(message)
    ```
- sync with the server
    - the server sends the complete data that the server has stored to the client in the form of a string.
    ```python
    # sync with the server
    completedata = clientCTRL._refresh() # this will return a string.

    # to get the list of lines in the file, do completedata.split('\n')
    completedata = completedata.split('\n')
    ```
- disconnect voluntarily
    ```python
    # disconnect
    clientCTRL._disconnect()
    ```


## Terminal Controls

### Check version
```bash
# in terminal/CMD, run

serversock -v # or serversock --version
```
### Show help text
```bash
# in terminal/CMD run

serversock -h # or serversock --help
```

## Uninstallation

serversock can be uninstalled using pip

```bash
# uninstall

pip uninstall serversock
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "serversock",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Soumyo Deep Gupta <deep.main.ac@gmail.com>",
    "keywords": "d33pster, serversock, socket-server, socket, multiclient, server, multiple-client",
    "author": null,
    "author_email": "Soumyo Deep Gupta <deep.main.ac@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/07/4e/9d22093440fdf720dec48b8452ae6ef799d9e06934241eac811d59ac77a6/serversock-0.1.tar.gz",
    "platform": null,
    "description": "# Overview\nserversock is a python module to create a server that can accept connection from multiple clients at the same time using multithreading.\n\n## Installation\nserversock is listed in pypi so the installation is very simple\n\n```bash\n# in your terminal/CMD run\n\npip install serversock\n```\n\n## Usage\n\n### Creating server\n\n```python\n# import package\nfrom serversock.serversock import _server\n\n# create class object\nserverCTRL = _server(address, port, bufffsize)\n```\n\nThe arguments of _server are defined below as\n\n```python\nclass _server:\n    def __init__(self, address:str, port: int, buffsize:int = 1024):\n        \"\"\"_server initialization\n\n        Args:\n            address (str): Enter Address like '0.0.0.0'\n            port (int): Enter port number, example: 8080\n            buffsize (int, optional): message buffsize. Defaults to 1024.\n        \"\"\"\n        ...\n    ...\n```\n\nAfter class object creation, start server\n```python\n# start server\n\nserverCTRL._start(serverfilename, responses)\n```\n\nThe arguments of _start are defined below as:\n```python\nclass _server:\n    ...\n    def _start(self, serverfilename:str, responses:int = 1):\n        \"\"\"start server\n\n        Args:\n            serverfilename (str): serverfilename to save server data\n            responses (int, optional): Number of response expected from client. Defaults to 1.\n        \"\"\"\n        ...\n    ...\n```\n\n### Creating clients\n```python\n# import _client class from serversock\n\nfrom serversock.serversock import _client\n\n# create class object\nclientCTRL = _client(serveraddress, serverport, serverbufflimit)\n```\nThe arguments of _client are defined below as:\n```python\nclass _client:\n    def __init__(self, serveraddress:str, serverport:int, serverbufflimit:int = 1024):\n        \"\"\"_client class initialization\n\n        Args:\n            serveraddress (str): server address like '0.0.0.0'\n            serverport (int): server port like 8080\n            serverbufflimit (int, optional): buffersize. Defaults to 1024.\n        \"\"\"\n        ...\n    ...\n```\n\nAfter that client can perform a bunch of tasks like send a message, sync with the server and disconnect voluntarily.\n\n- send message and get response in return\n    - client can send message to the server that the server will save.\n\n    ```python\n    # send message\n    clientCTRL._sendToServer(message)\n    ```\n- sync with the server\n    - the server sends the complete data that the server has stored to the client in the form of a string.\n    ```python\n    # sync with the server\n    completedata = clientCTRL._refresh() # this will return a string.\n\n    # to get the list of lines in the file, do completedata.split('\\n')\n    completedata = completedata.split('\\n')\n    ```\n- disconnect voluntarily\n    ```python\n    # disconnect\n    clientCTRL._disconnect()\n    ```\n\n\n## Terminal Controls\n\n### Check version\n```bash\n# in terminal/CMD, run\n\nserversock -v # or serversock --version\n```\n### Show help text\n```bash\n# in terminal/CMD run\n\nserversock -h # or serversock --help\n```\n\n## Uninstallation\n\nserversock can be uninstalled using pip\n\n```bash\n# uninstall\n\npip uninstall serversock\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Soumyo Deep Gupta  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "create multi-client server using multi-threading",
    "version": "0.1",
    "project_urls": {
        "Documentation": "https://d33pster.github.io/serversock/",
        "GitHub": "https://github.com/d33pster/serversock",
        "Issues": "https://github.com/d33pster/serversock/issues"
    },
    "split_keywords": [
        "d33pster",
        " serversock",
        " socket-server",
        " socket",
        " multiclient",
        " server",
        " multiple-client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9a63e93b9693ed388b2cbe78d88ee4ef209132dc97ceee0c08aa0ffefd2a09af",
                "md5": "0477488a87735437c2df4a7b33e3dc7c",
                "sha256": "d442ba03ef0a65799616e1f7e3d9a0fb04a96c763ab429fcdabf921f5283762d"
            },
            "downloads": -1,
            "filename": "serversock-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0477488a87735437c2df4a7b33e3dc7c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7499,
            "upload_time": "2024-03-29T16:07:16",
            "upload_time_iso_8601": "2024-03-29T16:07:16.762798Z",
            "url": "https://files.pythonhosted.org/packages/9a/63/e93b9693ed388b2cbe78d88ee4ef209132dc97ceee0c08aa0ffefd2a09af/serversock-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "074e9d22093440fdf720dec48b8452ae6ef799d9e06934241eac811d59ac77a6",
                "md5": "63c4cf93b55781f743ce7f4c123ead7f",
                "sha256": "66148fbe23f3851afe7c8137d17f1d88702167bc39e47cd9305b537b12c96241"
            },
            "downloads": -1,
            "filename": "serversock-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "63c4cf93b55781f743ce7f4c123ead7f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 7703,
            "upload_time": "2024-03-29T16:07:18",
            "upload_time_iso_8601": "2024-03-29T16:07:18.857314Z",
            "url": "https://files.pythonhosted.org/packages/07/4e/9d22093440fdf720dec48b8452ae6ef799d9e06934241eac811d59ac77a6/serversock-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-29 16:07:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "d33pster",
    "github_project": "serversock",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "optioner",
            "specs": [
                [
                    ">=",
                    "1.4.2"
                ]
            ]
        },
        {
            "name": "colorama",
            "specs": []
        }
    ],
    "lcname": "serversock"
}
        
Elapsed time: 2.28107s