'how to establish a python tcp tunnel in kcptune?

I am new to xtaci/kcptun. I am trying to receive TCP packets from my server to my local machine via kcptune. But I think I am missing something.

Server Side (it is hosted in aws and has public IP address):

./server_linux_amd64 -t "0.0.0.0:8388" -l ":4000" -mode fast3 -nocomp -sockbuf 16777217 -dscp 46

here I am running a TCP server at port 8388 in python. like this

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.bind(('0.0.0.0', 8388))
    s.listen()
    while True:
       conn, addr = s.accept()
       with conn:
          while True:
            signal_packet = conn.recv(1024)

Client Side:

client_windows_386.exe -r "ip_of_my_server:4000" -l ":8388" -mode fast3 -nocomp -autoexpire 900 -sockbuf 16777217 -dscp 46

here I am trying to connect to port 8388 of my server like this in the client:

HOST = 'ip_of_my_server'  # The server's hostname or IP address
PORT = 8388  # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))

But when I try to send data it is not being flowed via the kcp tunnel. I think I missing to understand the tunnel mechanism. I am messing up with most probably IP and port stuff. Any help, good people?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source