semvec/pypi-packages huggingface dataset:
aifaker 0.0.2
Faker information generator powered by LLM
Requires Python: >=3.6

# Introduction

Template for Python HTTP server project.

# Get started

- Click the **Run** button to run the project.
  ![Run](https://lf-cdn.marscode.com/obj/eden-sg/ljhwz_lkpkbvsj/ljhwZthlaukjlkulzlp/project_template/prod/04edcf103c3ed19965da6966212709d6078e241f/images/native_python/run.png)

- Go to **Ports** and preview the page at **port:8080**.
  ![CloudPort](https://lf-cdn.marscode.com/obj/eden-sg/ljhwz_lkpkbvsj/ljhwZthlaukjlkulzlp/project_template/prod/04edcf103c3ed19965da6966212709d6078e241f/images/native_python/cloud_port.png)

- Go to **Preview** and watch it.
  ![Preview](https://lf-cdn.marscode.com/obj/eden-sg/ljhwz_lkpkbvsj/ljhwZthlaukjlkulzlp/project_template/prod/04edcf103c3ed19965da6966212709d6078e241f/images/native_python/preview.png)

By default, MarsCode provide you with a default running configuration, running main.py. You can modify it in the **.vscode/launch.json**. Refer to [Visual Studio Code's doc](https://code.visualstudio.com/docs/editor/debugging) for how to configure launch.json.

# Learn more

- [Python](https://www.python.org/) - the official home of the Python programming language.

# Help

If you need help, you might be able to find an answer in our [docs](https://docs.marscode.com/). Feel free to report bugs and give us feedback [here](https://discord.gg/qtVMXEDbRw).
simple-sock 0.1.4
A Python library for simplified network and HTTP connections management.
Requires Python: >=3.6
Keywords: simplified, socket, simple, sock, network, easy

# simple-sock

`simple-sock` offers a straightforward interface for TCP and UDP sockets in Python, with support for optional SSL/TLS encryption and routing for TCP connections.

## Basic Usage

### Basic TCP Server

```python
from simple_sock import Server

app = Server()

@app.tcp_listen()
def handle_tcp(data):
    print("Received:", data.msg)
    return "Response from TCP server"

app.run("localhost", 5454)  # Optional parameters: keyfile=None, certfile=None, timeout=0, buffer_size=1024
```

### TCP Server with Routing

```python
from simple_sock import Server

app = Server()

@app.parse_route
def parse_route(data):
    return data.msg.split()[0]

@app.tcp_listen()
def default_route(data):
    return "Default response"

@app.tcp_listen("route1")
def route1(data):
    return "Response for route1"

app.run("localhost", 5454)
```

### Basic TCP Client

```python
from simple_sock import Client

client = Client()
client.connect("localhost", 5454)  # Optional parameters: udp=False, tls=False
client.send("Hello from TCP client")
response = client.recv()
print(response)
client.close()
```

### UDP Support

UDP usage is similar; use `@app.udp_listen()` for servers and set `udp=True` for clients. Example:

```python
# UDP Server
app = Server(udp=True)
@app.udp_listen()
def handle_udp(data):
    print("Received:", data.msg)
    return "Response from UDP server"
app.run("localhost", 5455")

# UDP Client
client.connect("localhost", 5455, udp=True)
client.send("Hello from UDP client")
response, addr = client.recv()
print(response)
client.close()
```

## License

MIT License

## Contact

For questions, contact Leonardo Oliveira at [email](mailto:lo570354@gmail.com).