This module is a sendfile(2)'s extension module which supports a transfer from a stream socket to a stream socket. It is not bi-directional. The implementation of transfering a socket to a socket is "zero-copy", meaning that it has been optimized so that copying of the socket data is avoided. Currently, this module supports only TCP and tested.
I think this module is useful when you have a plan to make a proxy server.
$ wget http://weongyo.org/project/freebsd/sendsock/sendsock-0.1.tar.gz $ tar xzf sendsock-0.1.tar.gz $ cd sendsock-0.1 $ make $ su - root # make load # make unload
(In Sever # 1) $ nc -l 9999 (In Reply Server # 2) $ cd sendsock-0.1 $ make -f Makefile.4test $ ./test_sendsock -t (server #1 ip) -p 9999 -l 10000 (In Client # 3) $ nc (relay server #2) 10000 < filename
$ ./ministat -w 73 -c 99.5 1000m_real_sendsock 1000m_real_rcvsnd x 1000m_real_sendsock + 1000m_real_rcvsnd +-------------------------------------------------------------------------+ |x x x xx*x * +*x + +x ++ + + +| | |_________MA____|_____|_____M___A______________| | +-------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 11 129.455 136.535 133.02 133.13645 2.0092308 + 11 133.047 142.791 136.374 136.97273 2.8720608 Difference at 99.5% confidence 3.83627 +/- 3.75385 2.88146% +/- 2.81955% (Student's t, pooled s = 2.47848)I transfered 100M bytes.
$ ./ministat -w 73 -c 99.5 100m_real_sendsock 100m_real_rcvsnd x 100m_real_sendsock + 100m_real_rcvsnd +-------------------------------------------------------------------------+ | + | | + | |x xx x x + + + | ||__M__A______| |__A__M|| +-------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 5 4.687 4.769 4.7 4.7198 0.035351096 + 5 5.028 5.074 5.073 5.0602 0.020042455 Difference at 99.5% confidence 0.3404 +/- 0.0817631 7.21217% +/- 1.73234% (Student's t, pooled s = 0.028735)
Last updated: 2007.05.28 Weongyo Jeong