Raj
Raj

Reputation: 3462

socat device files not removed when interface is closed

I am using socat version 1.7.3.2 to create a character device from a VLAN Ethernet device for communication. I create the device using following command:

socat INTERFACE:wwan0.vlan_dev1,type=2 PTY,mode=0777,rawer,link="/dev/ser_vlan0" &

It creates files as:

/dev/ser_vlan0 -> /dev/pts/22

Even after the wwan0 device is removed, the files /dev/ser_vlan0 and /dev/pts/22 still exist.

Is there a way to remove these files automatically when wwan0 no longer exists?

Upvotes: 0

Views: 1022

Answers (1)

Azeem
Azeem

Reputation: 14677

From socat's OPTIONS documentation:

-t < timeout >:

When one channel has reached EOF, the write part of the other channel is shut down. Then, socat waits seconds before terminating. Default is 0.5 seconds. This timeout only applies to addresses where write and read part can be closed independently. When during the timeout interval the read part gives EOF, socat terminates without awaiting the timeout.

You need to set the timeout as 0.

Upvotes: 1

Related Questions