RealistikDash / kcp.py

Python bindings and networking for the KCP protocol.
MIT License
18 stars 0 forks source link

Add support for customising KCP connection settings for server and client. #2

Closed RealistikDash closed 1 year ago

RealistikDash commented 1 year ago

Currently, all connections use the default KCP settings without allowing for customisation. This change should allow the user to call a function to customise the creation of all new KCP connections.

nominalval commented 1 year ago

Yes.

Would be fine if you could add at least those options :

ikcp_wndsize(kcp1, 128, 128);
ikcp_nodelay(kcp1, 0, 10, 0, 1);
RealistikDash commented 1 year ago

Will do today

RealistikDash commented 1 year ago

Actually, it appears this was already implemented in 69046130e76322be09275e59d4800b0093b4da6c and 3099f62ec8f83b9fd831e8253f4cce1bc6e6c016. It appears I forgot to close this.

This means that it is already possible to customise these settings. For KCPClientSync, it is done through the constructor:

    def __init__(
        self,
        address: str,
        port: int,
        conv_id: int,
        no_delay: bool,
        update_interval: int,
        resend_count: int,
        no_congestion_control: bool,
        receive_window_size: int,
        send_window_size: int,
    ) -> None:

For KCPServerAsync, you have two options:

Hope this helps!