Polling on socket descriptor does not return pollhup
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 closed immediately but waits until timeout happens and server shows EINPROGRESS rather than ECONNREFUSED.
I have the following code to poll on the socket-
When the other end of a FIFO closes socket descriptor, poll() doesn't return with POLLHUP set in revents. Instead it keeps waiting on Solaris till the timeout happens.
Is it the case that on Linux poll call will return POLLHUP and on Solaris it will not?
Last edited by Scott; 04-23-2010 at 03:30 AM..
Reason: Code tags, please...
HI
I need some help on this below one
Have summuary file coming on daily basis with list of file names and count ,if the summuary file not exist ,pool it for every 5 mins till it arrives .Once arrived remove first and last line from the file and check all the files in respective director all... (12 Replies)
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)
Hi!
Im trying to make a program that polls a mysqlDB every 5 minutes.
the poll checks a scheduletable in the dB and exicutes a function if
there was a "go" in the scheduletable, and if it retrives a "no go" from the table
it should just wait for another 5 minutes before re polling the DB,
... (1 Reply)
I need clarification on whether it is okay to set socket options on a listening socket
simultaneously when it is being used in an accept() call?
Following is the scenario:-
-- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Hi,
I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime.
To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Hi all,
I have a directory where some process is keeping incremental/new log files. I need to code a program which will periodically poll this directory and if it founds a new file arrived then copy that new file to some other specific directory.
We are OK with this polling approach. I just... (3 Replies)
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:
>>> import... (2 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 have a server and client code.
My server says accept and my client says a connect.
After accept when i print inet_ntoa(cin.sin_addr) by running the client on same machine i get 127.0.01 but accept returns a zero. Now when i try to do a recv from the client the recv never waits for a send. It... (7 Replies)
BIO_s_socket(3) OpenSSL BIO_s_socket(3)NAME
BIO_s_socket, BIO_new_socket - socket BIO
SYNOPSIS
#include <openssl/bio.h>
BIO_METHOD *BIO_s_socket(void);
long BIO_set_fd(BIO *b, int fd, long close_flag);
long BIO_get_fd(BIO *b, int *c);
BIO *BIO_new_socket(int sock, int close_flag);
DESCRIPTION
BIO_s_socket() returns the socket BIO method. This is a wrapper round the platform's socket routines.
BIO_read() and BIO_write() read or write the underlying socket. BIO_puts() is supported but BIO_gets() is not.
If the close flag is set then the socket is shut down and closed when the BIO is freed.
BIO_set_fd() sets the socket of BIO b to fd and the close flag to close_flag.
BIO_get_fd() places the socket in c if it is not NULL, it also returns the socket. If c is not NULL it should be of type (int *).
BIO_new_socket() returns a socket BIO using sock and close_flag.
NOTES
Socket BIOs also support any relevant functionality of file descriptor BIOs.
The reason for having separate file descriptor and socket BIOs is that on some platforms sockets are not file descriptors and use distinct
I/O routines, Windows is one such platform. Any code mixing the two will not work on all platforms.
BIO_set_fd() and BIO_get_fd() are macros.
RETURN VALUES
BIO_s_socket() returns the socket BIO method.
BIO_set_fd() always returns 1.
BIO_get_fd() returns the socket or -1 if the BIO has not been initialized.
BIO_new_socket() returns the newly allocated BIO or NULL is an error occurred.
SEE ALSO
TBA
50 2013-03-05 BIO_s_socket(3)