Socket Api 2
Socket Api 2 creates the best connection between a server and client/clients.
Supported language is python 3. (Package wrote in 3.9-3.10.1)
- Checks if client is still connected.
- If server is not responding more, there is a feature that the client tries to reconnect. (optional)
- Colored Logging in console/file. (optional)
Installation
Use this command:
pip install socket-api2
Change Log
0.1.9-0.2.0 (01/26/2022):
-
Added server.shutdown option parser
-
Recv/Send speed upgrade
-
Client connection management upgrade
0.1.3-0.1.8 (01/24/2022):
-
Updated OOPClient from Server
-
Upgraded README.md
-
Reworked response from recv
-
Upgraded README.md
-
Fixed return issues
-
Added ngrok_url property to server
-
Fixed return errors
-
Added shutdown function to server
-
Fixed ngrok usage
0.1.2 (01/07/2022):
- Optimized
- Added KeyboardInterrupt parsing.
- Fixed some bugs
0.1.1 (10/16/2021):
- Fixed bugs
Examples
Difference between SEND_METHOD.default_send and SEND_METHOD.just_send, with the default send the program send a lenght of the message then send the message to know how many bytes we need to receive, but the just_send is just send the message.
Example for Server:
from socket_api2 import *
server = Server(ip="auto", port=5555, client_timeout=10)
@server.on_client_connect()
def handling_client(client):
while True:
if client.is_connected:
resp = client.recv(2048)
if resp.error:
print("There is an error: " + resp.error)
if resp.text == "hi":
client.send("hi 2", method=SEND_METHOD.default_send)
elif resp.text == "I love u":
client.send("I love u too")
else:
client.send("no hi", method=SEND_METHOD.just_send)
else:
break
server.start()
Example for Client:
from socket_api2 import *
client = Client(target_ip="IP", target_port=5555, timeout=10)
status_code, error = client.connect()
if status_code == 200:
client.send("hi")
resp = client.recv(2048)
if resp.code == 200:
print("We successfully received a message. Message: " + resp.text)
client.send("I love u", method=SEND_METHOD.just_send)
client.recv(2048)
else:
outstr("ERROR", f"Something went wrong... --> {error}")
Metadata
Release files for socket-api2 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| socket_api2-0.2.0.tar.gz | 7.7 kB | Without provenance | Details for socket_api2-0.2.0.tar.gz |
Release files / socket_api2-0.2.0.tar.gz
| Download URL | socket_api2-0.2.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99f1fbfd5984b80a861d7af198c7b3e82ef1979909f5df89e58aece130238bf1
|
|
BLAKE2b-256 checksum How to use checksums |
94cccb4d61dbd42990ef5e26c5d060032c0b7e0d815f743079926b5ef4f97e9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Security for socket-api2 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.