I have seen these question on descriptor passing on SO.
- Descriptor passing with unix domain sockets
- Sending file descriptor over UNIX domain socket, and select()
i wrote following two programs to work with Unix domain socket
which are intended to work as
Main program accepts all client connections and send those descriptors to running service program (Descriptor receiver) .Descriptor receiver recvs descriptor and set them to fd_set and use select
to check whether a descriptor is readable or not if it's ready to read then read the descriptor into buffer and send string length to client.
Note : I am testing using telnet on ubuntu 14.10
Major problem with this program is that FD_ISSET() return false
even though descriptor is ready to read i.e. Select() is keeps on waiting .
Some of the time it works , in this case it recvs few message and hang .
I have tried all three flavor of send and recv descriptor functions but none of them work perfectly .
How to resolve this error ?