Example codes of Ruby's TCP related network programming, including:
- basic classical style (bind-listen-accept-read-write-close) TCP server
- basic TCP server with ruby's style
- interactive TCP server
- multiplexing a TCP server with either
Thread
orProcess
- basic TCP server with EventMachine
- two versions of SOCKS5 server with EventMachine
- adding your own logics to the SOCKS5 server
This command indicates connections bind to your interested port. Replace PORT
with a real port number such as 23333
.
watch -n 0 'netstat -nta | grep PORT'