Skip to content

a small demo shows how to use epoll.small program implements port forwarding with epoll.also support Windows using wepoll

License

Notifications You must be signed in to change notification settings

AlpsMonaco/epoll-tcp-port-forward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

epoll-tcp-port-forward

This program implements TCP port forwarding using epoll.
It is designed for those who want to learn epoll through a practical project.
Note: This program is not recommended for production use.
For production, IPTABLES IS A BETTER CHOICE.

Compile And Run

# Requires cmake to build this project
cd epoll-tcp-port-forward
cmake -B ./build .
cmake --build build --config MinSizeRel --target all
./build/tcp_port_forward 31212 127.0.0.1 22 # Forward any data from port 31212 to local port 22

Alternatively, you can simply run:

gcc tcp_port_forward.c
./a.out 31212 127.0.0.1 22 # Forward any data from port 31212 to local port 22

Windows

There's no native epoll support on Windows.
Thanks to wepoll,an open source library that implements epoll API,you could still run this project on Windows.

cd epoll-tcp-port-forward\windows
git submodule update --init
cmake -B ./build .
cmake --build build --config MinSizeRel --target all
.\build\tcp_port_forward 31212 127.0.0.1 22 # Forward any data from port 31212 to local port 22

Releases

No releases published

Packages

No packages published