1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-06-24 00:48:43 +00:00

add generic setsockopt address options

This commit is contained in:
Gerhard Rieger 2008-05-03 21:44:48 +02:00
parent 52be3b085e
commit 140443794b
9 changed files with 192 additions and 7 deletions

View file

@ -286,11 +286,27 @@ $ socat -d -d -d -d - udp-datagram:224.0.0.2:6666,bind=:6666,ip-add-membership=2
// socket bound to specific address
//=============================================================================
// IOCTL
// GENERIC FUNCTION CALLS
// open CD drive (given value valid on Linux)
// ioctl(): open CD drive (given value valid on Linux)
// on my Linux system I find in /usr/include/linux/cdrom.h the define:
// #define CDROMEJECT 0x5309 /* Ejects the cdrom media */
// the following command makes something like ioctl(fd, CDROMEJECT, NULL)
$ socat /dev/cdrom,o-nonblock,ioctl-void=0x5309 -
// setsockopt(): SO_REUSEADDR
// the following command performs - beyond lots of overhead - something like:
// myint=1; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &myint, sizeof(myint))
$ socat -u udp-recv:7777,setsockopt-int=1:2:1 -
// setsockopt(): SO_BINDTODEVICE
// ways to apply SO_BINDTODEVICE without using the special socat address option
// so-bindtodevice:
// with string argument:
$ sudo ./socat tcp-l:7777,setsockopt-string=1:25:eth0 pipe
// with binary argument:
$ sudo ./socat tcp-l:7777,setsockopt-bin=1:25:x6574683000 pipe
===============================================================================
// not tested, just ideas, or have problems