WSAAsyncSelect equivalent for linux


 
Thread Tools Search this Thread
Top Forums Programming WSAAsyncSelect equivalent for linux
# 1  
Old 01-20-2011
WSAAsyncSelect equivalent for linux

Hello, I'm writing a multi-threaded socket server in C++ and I needed something like wsaasyncselect to handle messages like fd_accept, fd_read, fd_connect, fd_close.

Thanks in advance.

Last edited by lucastonon; 01-20-2011 at 01:35 PM..
# 2  
Old 01-21-2011
Linux doesn't have a Windows event loop, of course.
# 3  
Old 01-21-2011
You can use fcntl() to set the O_ASYNC flag on your file descriptors.

Your process will then receive a SIGIO signal when IO is possible on those file descriptors. Which file descriptor will be specified in the siginfo_t structure you get with each SIGIO signal. The siginfo_t structure might also contain other information as well, but offhand I don't recall if there is any additional data.

You need to be real careful in your signal handler, though. Any system call you make from within the signal handler or anything it calls MUST be async-signal safe. For example, no malloc()/free() or new/delete or anything else that might make those calls.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Linux equivalent for UNIX

I have a folder called "log" which has a few sub-folders say "fda" "fd7" "fdd" "fd6 .... " I wish to fire the below command inside each subfolder starting with the folder with the latest time stamp. grep "$greptime.*exit" Prod.$(hostname).log | grep $fdrdate_new If the seach did not yield... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. Red Hat

NFS_v4_fail_over_timeout equivalent in Linux

Hi, I need to mount a replicated nfs4 export on a number of AIX and Redhat hosts. To get the failover on the clients working smoothly, I need to change certain values on the AIX boxes like nfs_v4_fail_over_timeout, timeo and retrans values. Since I have no clue about Linux, I am not quite sure... (1 Reply)
Discussion started by: zxmaus
1 Replies

3. Linux

/etc/netmasks equivalent in linux

Hi Guys, I am used to configuring DHCP on Solaris and foreach subnet added I place a corresponding entry in /etc/netmasks. I am now looking at configuring DHCP on linux, is there an equivalnet entry required somewhere or is this not needed in linux Thanks (3 Replies)
Discussion started by: eeisken
3 Replies

4. Linux

Linux equivalent for...

I moved to a Linux system from Windows a few months ago. Most of the programs I had been using were already native to Linux (Firefox, the GIMP, Pari, etc.) and most others I found a close enough program (Crimson Editor -> gedit, Visual Studio -> KDevelop, Primo -> Morain's ECPP). Now I'm down... (1 Reply)
Discussion started by: CRGreathouse
1 Replies

5. Linux

Mksysb Equivalent For Linux?

I have experience with making bootable images of AIX systems using mksysb and wondered if there was some type of equivalent software for Linux. Or perhaps some of the folks here have alternatives or unique ideas for how they are backing up their Linux systems enabling them to recover them as... (13 Replies)
Discussion started by: scotbuff
13 Replies

6. UNIX for Dummies Questions & Answers

What is the equivalent of Solaris snoop in Linux

What is the equivalent of Solaris snoop in Linux I could not find snoop in RHEL (2 Replies)
Discussion started by: santosh149
2 Replies

7. UNIX for Advanced & Expert Users

Equivalent for iostat -e in AIX HP-UX Linux

iostat -e gives the soft, hard and transport error information in Solaris. What is the equivalent command in the other flavors of Unix AIX HP Linux. Thanks Prasi (1 Reply)
Discussion started by: prasi_in
1 Replies

8. Linux

Linux equivalent for daemon2

Hi all... In my Unix system a program exists called "daemon2" which is responsible to enqueue program executions. For example, if I want to make the system to enqueue lpr executions for certain users, I call daemon2 with lpr as the parameter. Is there an equivalent in Linux? Thanks Jaime (0 Replies)
Discussion started by: jstuardo
0 Replies

9. Shell Programming and Scripting

Equivalent Suse Linux command

hi, In solaris, psrinfo gives number of cpu in use/online and so on. What is the equivalent command for "psrinfo" in Suse Linux ? Thx (3 Replies)
Discussion started by: braindrain
3 Replies

10. Linux

windows startup equivalent in linux

hi all, greetings, please tell me how to start a java GUI program in the startup of the machine. since it invokes a GUI is it possiable to entry the same in /etc/rc2.d/S99userdefinedfiles. thanks in advance ., :-) (1 Reply)
Discussion started by: raguramtgr
1 Replies
Login or Register to Ask a Question