Sponsored Content
Top Forums Programming Anyone know how to use socket select() function? Post 302160144 by softweyr on Monday 21st of January 2008 02:22:02 AM
Old 01-21-2008
Sample select server in FreeBSD ports

My 'liedentd' is a simple select(2)-based server program that is a good example of how to write a high-performance select loop. It is available in the FreeBSD ports system, under security/liedentd, or you can fetch the source from:

ftp://ftp.freebsd.org/pub/FreeBSD/po...ntd-1.1.tar.gz

The entire source code is in liedent.d, about 300 lines of C source.
 

10 More Discussions You Might Find Interesting

1. Programming

How to convert the "select" function into a "poll" function

i have a program using the select function but i want to convert it to poll... how can i do this? thanks in advance... :) (1 Reply)
Discussion started by: rbolante
1 Replies

2. Shell Programming and Scripting

send function in socket

Hi All, I encountered a stange problem while doing a perl script to use socket. i need to transfer a file from client to sever. but error came as argument missing in send function.........Plz tell me the wt r the arguments in send and recv functions....... (0 Replies)
Discussion started by: trupti_rinku
0 Replies

3. Programming

select function

Dear all, I am using select function for the socket programming. What is the purpose of except fd's fd set in the argument. (0 Replies)
Discussion started by: nagalenoj
0 Replies

4. Programming

Multiplexing socket and message queue using Select()

I have a socket and a message queue over which i am trying to multiplex input using select(). When data comes over socket the select works but when it comes over message queue the select is not detecting it . Create_Q gets the identifier of the messege queue. ... (1 Reply)
Discussion started by: shaurya.rastogi
1 Replies

5. Programming

connect() function in C++ socket programming

Hello All, I have a problem using connect(...) function in C++. I am using SSH from my windows system to connect it to linux server. The program works fine if I run it directly in Linux machine but I need it to run through windows machine. The function returns -1 and so my program terminates. ... (3 Replies)
Discussion started by: smdhd3
3 Replies

6. Programming

Please help! accept function problems in Socket programming

Hi, I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused: After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies

7. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

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)
Discussion started by: chandrutiptur
0 Replies

8. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

9. Programming

I am a little bit confused in a socket example through select()

Hi, I am a newbie about network programming. All codes come from this book: UNIX Network Programming Volume 1, Third Edition. It is a TCP server by use select() int main(int argc, char **argv) { int i, maxi, maxfd, listenfd, connfd, sockfd; int ... (2 Replies)
Discussion started by: sehang
2 Replies

10. Programming

Socket and select

I have created two sockets and binded both. My requirement is that 2nd socket must send/ recv data only on expiration of timeval(tv). but the 1st socket must keep on send/recv the data without waiting for the 2nd socket completion...... I have posted my code below...... In this code the 2nd... (3 Replies)
Discussion started by: naresh046
3 Replies
DISCONNECTX(2)						      BSD System Calls Manual						    DISCONNECTX(2)

NAME
disconnectx -- disconnects a connection on a socket SYNOPSIS
#include <sys/socket.h> int disconnectx(int socket, sae_associd_t associd, sae_connid_t connid); DESCRIPTION
The parameter socket is a socket. The communication domain of the socket determines the availability and behavior of disconnectx(). For connection-oriented socket, disconnectx() is analogous to shutdown(2) with SHUT_RDWR issued on the socket. For connectionless socket, it dis- associates any existing association to the peer socket. The parameter associd specifies the association identifier. It should be set to SAE_ASSOCID_ANY. The parameter connid should be set to SAE_CONNID_ANY. NOTES
disconnectx() is currently supported only on AF_INET and AF_INET6 sockets of type SOCK_DGRAM and SOCK_STREAM. RETURN VALUES
The disconnectx() function returns the value 0 if successful; otherwise the value of -1 is returned and the global integer variable errno is set to indicate the error. ERRORS
The disconnectx() system call succeeds unless: [EALREADY] Operation already in progress. [EBADF] Socket is not a valid descriptor. [EINVAL] The associd or connid argument is invalid or the underlying protocol is no longer attached to socket. [ENOTCONN] The socket is not connected. [ENOTSOCK] Socket is a file, not a socket. SEE ALSO
connect(2), connectx(2), socket(2), compat(5) HISTORY
The disconnectx() function call appeared in Darwin 15.0.0 Darwin April 10, 2015 Darwin
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy