Get the file descriptor of a socket file. C vs Python.
Hi,
I want to validate that a file is a socket file on Linux. I know I can do this using the S_ISSOCK macro, but I am not sure how to get the file descriptor for the socket file.
For example, I know that /tmp/mapping-foo is a socket file. In Python I can do something like this:
How ever in C, I am unable to get the file descriptor for the file /tmp/mapping-foo. I tried using open, fopen and fileno as follows:
But, I am getting this error message:
I have BIND 9.8.1-P1 cache only DNS server running in Solaris 10. I have upgraded the same from 9.6.1 to 9.8.1-P1. Now i am facing "file descriptor exceeds limit (4096/4096)" error frequently on the server.
Please help me on this issue! (1 Reply)
I am trying to write a script which will only show me the file descriptor count for a process/pid. My script will return me the count only not the whole output. For example, I would like my script to return the output 23 this case, not the whole output.
Can anybody please help me how do I get... (11 Replies)
Hi ,
i have two basic requirement on linux platform . I am using C language to do this .
1) copying one file to another (assuming i know their file descriptors)
2) Overwriting a file using it file descriptor .
Please guide.
regards
Aki (2 Replies)
hi....,
can anyone tell me what is the exact difference between file descriptor and file pointer...... and why file descriptor takes integer value???:confused: (10 Replies)
I have a query related to the functioning of poll() system call on solaris and linux platforms.
When the client is abnormally terminated, it is observed that on Linux the socket is immediately closed and the server gets ECONNREFUSED.
But in case of Solaris it is observed that the socket is not... (0 Replies)
Hello All,
Im opening a file desciptor in perl and sending data using print CMD "$xyz".
is there a limit to the length of the string that I can give to this CMD at a time. (3 Replies)
Hi Friends,
I have written a program which will listener for more than 1000 requests per second from a single socket descriptor and then it will process those requestes. Its taking X amount of time. Now i want to reduce that time. Will I can write multiple threads to receive the... (2 Replies)
I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)