How to decide if a file descriptor is attached to a file or socket in Linux
Using C language in Linux, how to decide if a file descriptor is attached to a file or socket?
I have a full URL path for a file attachment in our JIRA installation (e.g. /jira/secure/attachment/40226/FileName.jpg). However, I'm not sure what Issue this file is currently attached to, since the
I keep getting a Bad file descriptor error when I try to send data from my tcp server to my tcp client. What does this mean in terms of sockets? I have been at this for awhile now and I don't see wh
i was encountering a situation where my Postgres Unix socket File gets deleted . Ideally when our application is running the Postgres deamon should not go down at all . However the postmaster does go
How can I get the file descriptor for the port on which the client has been bound. I want this to share the port in between different processes. I am able to get the file descriptor for the tcp server
I am trying to send the contents of a file from the server to the client , I am reading the file line by line using fgets and writing to the socket descriptor line by line , on the client side , i am
How do I get the attached file from this email? This email is sent from an apple computer and the email struture is not like any other (surprise).. here the part with the disposition is one dimension
I am writing a program to capture socket network flow to display network activity. For this, I was wondering if there is any way I can determine the socket type from the socket descriptor. I know that
I was wondering what is a file descriptor of the network socket and how to get it? I believe it is a number?
In Linux, to create a socket we include the sys/socket.h header file and use the socket() function. The header file is located at /usr/include/sys/socket.h. extern int socket (int __domain, int __typ
Can we use both fcntl locking and flock locking (not simultaneously) on a shared file descriptor, if we want to share a lock between threads/processes?
Similar question: Can Ant's tar task set a Linux file permission even when the task is used on other platforms? If I use Maven 2 assembly plugin with the 'project' descriptor, is there a way to set sh
I am trying to understand how are file descriptors related to sockets. As per my understanding, you listen on a particular file descriptor, once a connection comes in , you accept it , which returns y
I am trying to receive a file (audio, .CAF) from a socket in C (C++ solution ok as well). I have the socket communication working, having tested it with strings. My problem is I don't know what to sup
what is the upper limit of file-descriptor that can be used in any Linux system (specifically ubuntu 10.04)? I am using Ubuntu 10.04 (64-bit) and my CPU architecture for server is x86_64 and for clie
I was wondering if it's possible manage pointer to socket udp file descriptor cause I have to sending data with send() to 2 different socket simultaneously. I have a function that creates 2 sockets (s
Here's the situation: The fd_set is created and initialized: fd_set readset; //fd_set named readset FD_ZERO(&readset); //clearing fd_set FD_SET(listen_socket, &readset); //adding a listening s
I'm working on a server application that's going to work on Linux and Mac OS X. It goes like this: start main application fork of the controller process call lock_down() in the controller process ter
Possible Duplicate: What's the difference between a file descriptor and file pointer? If I open file like this: FILE *fp = fopen(mr32.txr,r); then fp is file pointer or file descriptor? What is
In C++, is there a way to check if a file descriptor is still open, long after it was initially opened?
I'm playing around with a webserver, using a unix socket and sendmsg / recvmsg to pass the socket file descriptor to a new server process without losing any requests. While testing it with ab I found
In linux, I can do a stat on a file in the proc directory and determine if it is a socket. root@dev:/proc/2221/fd# stat 100 File: `100' -> `socket:' How can I get this same result with per
Is it possible to set the file extension of the attached intents? This code works for me but the attaced images has file names like flag_be and is not recognzied by the reciving email client as an im
$ which file /usr/bin/file $ file /usr/bin/file /usr/bin/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped Why does
I want to create an index.html file in each folder of my project in linux. index.html should contain some sample code. How can i create a file in single command ? Thanks.
We've recently upgraded our servers from PHP 5.4.15 to 5.5.1 and have started getting this error in the logs Fatal Error Unable to create lock file: Bad file descriptor I've tracked it down to this
I have a bash-script in which I want to communicate to the user on standard out, but also send commands to a sub-process via a file descriptor -- like this: # ... # ... echo Hello user, behold a clea
I'm trying to do the following: execl(/bin/grep,grep,print,fd,NULL); where fd is a file descriptor. So basically this should grep for print in the file pointed to by fd. It doesn't seem to w
From Beej's socket programming book: When Unix programs do any sort of I/O, they do it by reading or writing to a file descriptor. A file descriptor is simply an integer associated with an open file.
I have a file descriptor that is set to a positive value with the result of a open() function so this fd is indicating a file. When i delete the actual file fd is still a positive integer. I want to k
Hii i am uploading a file to server using socket and i need the percent of file loaded?how can i do that?i have the maximun value i.e the file length ,how can i get how much file has been uploaded? Fi
According to the docs http://developer.android.com/reference/android/hardware/usb/UsbDeviceConnection.html#getFileDescriptor() returns file descriptor which can be used in native code. How can i pass
I am using an ubuntu EC2 amazon machine. I need to know the currently attached volumes. I used the following command: cat /proc/partitions But, I get: cat: proc/partitions: No such file or directory.
What maximum value of socket descriptor, which I get using functions socket() and accept() on Linux and Windows?
I have a scenario where i created pipe for communication between two child and parent. Parent writes (using write function)data to the pipe and closes the respective file descriptor. The problem is wh
A keypoint descriptor is created by first computing the gradient magnitude and orientation at each image sample point in a region around the keypoint location. But i confused about the meaning of reg
When sockets are created or files are opened/created in C, is the file descriptor that's assigned to the socket/file guaranteed to be the lowest-valued descriptor available? What does the C spec say a
This may sound like an odd question, but when I go and open a file: int fd; fd = open(/dev/somedevice, O_RDWR); What exactly am I getting back? I can see the man page says: The open() function shal
The program connects to a server, and when the connection is closed by the server, if I try to reconnect it says: socket.error: [Errno 9] Bad file descriptor If I close the socket in the client and th
I have two files, file1 and file2. How do I append the contents of file2 to file1, without overwriting the current file1. How do I do this on Ubuntu Linux?
I am trying to share a socket descriptor with another local process on the same Linux machine. These processes are unrelated i.e., they are not parent/child related and are not forked. They are inde
In a group talk I was intrigued by this question - Why UNIX standard demands the guarantee of allocation of only lowest available file descriptor for a process ? And only possible answer that I could
I have a file descriptor (edit: the resource returned by fopen on a stream that is not necessarily a local file) that is being passed into a black box. When it pops out, is it possible to determine wi
Is HANDLE similar to file descriptor in Linux? As far as I know, HANDLE is used for handling every resources on Windows, such as font, icons, files, devices..., which in essence is just a void pointer
I’m seeking help to understand the following situation: 1. I have a TCP socket connection established the peer. 2. I added to the list of file descriptors to be monitored by select 3. select alerts me
In a linux kernel module is there a way to get a file name/path from an unsigned int fd? I'm aware of this answer: How can I get a filename from a file descriptor inside a kernel module? but if I unde
I am using eclipse IDE and want to edit the attached source file of the jar file. For doing this i downloaded the src.zip and attached the file, but it is opening as a .class though I am able to read
If I try executing the following code f = file('test','rb') fout = file('test.out','wb') for i in range(10): a = f.read(1) fout.write(a) f.close() f = fout f.seek(4) print f.read(4) Where 'test' is a
I just dont understand what is wrong with my code, The goal is to encrypt one file using other file as a key using bitwise xor. It works, the problem is that the while is executed only one time and th
I'm using select() call to detect input presence in the main cycle of my program. This makes me use raw file descriptor (0) instead of stdin. While working in this mode I've noticed that my software o
Is there a way to retrieve path information from a file descriptor or FILE pointer? I'm aware that this data may not always be relevant/useful for case where the file descriptor is a socket, pipe, et