Sponsored Content
Top Forums Programming select() system call takes longer than the timeout specified Post 302411241 by Driver on Thursday 8th of April 2010 04:24:19 AM
Old 04-08-2010
Quote:
Originally Posted by Corona688
What does this mean for a socket however, which cannot be deleted or resized? According to the linux man page, it happens when received data is discarded due to checksum errors etc.
I think some versions of their implementation also drop packets during system memory shortage even after having reported availability with select(). For TCP sockets, I believe there may be a race condition between select() and accept() on some implementations if a half-opened connection is dropped before it can be accepted. But that one may just as well always yield ECONNABORTED, at least on current systems (as indicated by accept )

It is unlikely to encounter these problems so select() + blocking sockets mostly works Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

2. UNIX for Advanced & Expert Users

Login Process takes longer

Hello. Since Yesterday, I notice that after giving telnet IP or SSH IP - it takes long time to display login: , I mean earlier after entering Server name It used to immediately ask for login ID and then password. But, now it takes min of 2-3 minute to ask for password. Where can I check,... (12 Replies)
Discussion started by: panchpan
12 Replies

3. UNIX for Advanced & Expert Users

how to use exceptfds argument in select system call

Hi, Can any one tell me how to use the fourth argument of select system call.I saw example "port forwarding" on the net,but it was too complex for me to understand.Can any one explain me about the usage of exceptfds argument of select system call with simple example. Thanks. (2 Replies)
Discussion started by: bvijaya
2 Replies

4. UNIX and Linux Applications

Syb15 Query takes longer, help me out

When i run the below query in syb15 (with syb 12.5.X backward compatibilty) environment it runs 45min where as the same in syb12.5.1 it takes only 7-10min. But the main thing is stld_date(in the below query) does not covered in the index of that table. Also main_table is a huge table. So is it... (1 Reply)
Discussion started by: prsam
1 Replies

5. Programming

Having some trouble with select() call in C

I have this while loop: while (notdone) { //Set the timers waitd.tv_sec = 5; waitd.tv_usec = 0; FD_ZERO(&tempreadfds); FD_ZERO(&tempwritefds); FD_ZERO(&readfds); /* initialize the read fd set */ FD_ZERO(&writefds); /* initialize the write fd set */ ... (1 Reply)
Discussion started by: Legend986
1 Replies

6. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

7. Shell Programming and Scripting

system call

Trying to figure out a load issue with a webserver. I have traced a php script and noticed the following connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("XX.XX.XX.XX")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000035> poll(, 1, 2000) = 1 () <0.000120>... (5 Replies)
Discussion started by: rajan007
5 Replies

8. Homework & Coursework Questions

program to send messages to parent using pipes and select system call

Write a program using select, which will create some number of child processes that continuously send text messages to the parent process using pipes. Each child has its own pipe that it uses to communicate with the parent. The parent uses select () to decide what pipes should be processed to... (1 Reply)
Discussion started by: ripssingh
1 Replies

9. UNIX for Advanced & Expert Users

Issues with select system call

1. We are using client-server model communication using TCP/IP protocol 2. The TCP socket created with O_NON_BLOCK flag 3. When we make attempt to send large data to other process, the send is partially successful. It means we attempt to send 90K data, OS sent only 40K data successfully. ... (3 Replies)
Discussion started by: MasthanDudekula
3 Replies

10. Shell Programming and Scripting

Timeout to abolish ssh connection command it takes too long

Hi, I am running a ssh connection test in a script, how can I add a timeout to abolish the process if it takes too long? ssh -i ~/.ssh/ssl_key useraccount@computer1 Thank you. - j (1 Reply)
Discussion started by: hce
1 Replies
ACCEPT(2)						      BSD System Calls Manual							 ACCEPT(2)

NAME
accept, paccept -- accept a connection on a socket LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/socket.h> int accept(int s, struct sockaddr * restrict addr, socklen_t * restrict addrlen); int paccept(int s, struct sockaddr * restrict addr, socklen_t * restrict addrlen, const sigset_t * restrict sigmask, int flags); DESCRIPTION
The argument s is a socket that has been created with socket(2), bound to an address with bind(2), and is listening for connections after a listen(2). The accept() argument extracts the first connection request on the queue of pending connections, creates a new socket with the same properties of s and allocates a new file descriptor for the socket. If no pending connections are present on the queue, and the socket is not marked as non-blocking, accept() blocks the caller until a connection is present. If the socket is marked non-blocking and no pending connections are present on the queue, accept() returns an error as described below. The accepted socket may not be used to accept more con- nections. The original socket s remains open. The argument addr is a result parameter that is filled in with the address of the connecting entity, as known to the communications layer. The exact format of the addr parameter is determined by the domain in which the communication is occurring. The addrlen is a value-result parameter; it should initially contain the amount of space pointed to by addr; on return it will contain the actual length (in bytes) of the address returned. This call is used with connection-based socket types, currently with SOCK_STREAM. It is possible to select(2) or poll(2) a socket for the purposes of doing an accept() by selecting or polling it for read. For certain protocols which require an explicit confirmation, such as ISO or DATAKIT, accept() can be thought of as merely dequeuing the next connection request and not implying confirmation. Confirmation can be implied by a normal read or write on the new file descriptor, and rejection can be implied by closing the new socket. One can obtain user connection request data without confirming the connection by issuing a recvmsg(2) call with an msg_iovlen of 0 and a non- zero msg_controllen, or by issuing a getsockopt(2) request. Similarly, one can provide user connection rejection information by issuing a sendmsg(2) call with providing only the control information, or by calling setsockopt(2). The paccept() function behaves exactly like accept(), but it also allows to set the following flags on the returned file descriptor: SOCK_CLOEXEC Set the close on exec property. SOCK_NONBLOCK Sets non-blocking I/O. It can also temporarily replace the signal mask of the calling thread if sigmask is a non-NULL pointer, then the paccept() function shall replace the signal mask of the caller by the set of signals pointed to by sigmask before waiting for a connection, and shall restore the sig- nal mask of the calling thread before returning. RETURN VALUES
The accept() and paccept() calls return -1 on error. If they succeed, they return a non-negative integer that is a descriptor for the accepted socket. COMPATIBILITY
The accept() implementation makes the new file descriptor inherit file flags (like O_NONBLOCK) from the listening socket. It's a traditional behaviour for BSD derivative systems. On the other hand, there are implementations which don't do so. Linux is an example of such implemen- tations. Portable programs should not rely on either of the behaviours. ERRORS
The accept() will fail if: [EAGAIN] The socket is marked non-blocking and no connections are present to be accepted. [EBADF] The descriptor is invalid. [ECONNABORTED] A connection has been aborted. [EFAULT] The addr parameter is not in a writable part of the user address space. [EINTR] The accept() call has been interrupted by a signal. [EINVAL] The socket has not been set up to accept connections (using bind(2) and listen(2)). [EMFILE] The per-process descriptor table is full. [ENFILE] The system file table is full. [ENOTSOCK] The descriptor references a file, not a socket. [EOPNOTSUPP] The referenced socket is not of type SOCK_STREAM. SEE ALSO
bind(2), connect(2), listen(2), poll(2), select(2), socket(2) HISTORY
The accept() function appeared in 4.2BSD. The pselect() function is inspired from Linux and appeared in NetBSD 6.0. BSD
June 2, 2011 BSD
All times are GMT -4. The time now is 04:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy