LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2009, 06:40 AM   #1
thirumalesh
Member
 
Registered: Sep 2007
Posts: 54

Rep: Reputation: 15
WSAAccept( ) Analogous in Linux


Hi friends,

can any body help me in implementing a server program which conditionally accepts a connection from client in linux..

like WSAAccept() in windows....

Thanks in advance.......
 
Old 02-18-2009, 09:35 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
No such API exists in most (non-Microsoft) sockets implermentations.

Here's why:
http://www.experts-exchange.com/Netw..._21276182.html

Last edited by paulsm4; 02-18-2009 at 11:04 AM.
 
Old 02-18-2009, 10:03 AM   #3
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by thirumalesh View Post
Hi friends,

can any body help me in implementing a server program which conditionally accepts a connection from client in linux..

like WSAAccept() in windows....

Thanks in advance.......
What condition do you want to impose?
 
Old 02-18-2009, 11:39 PM   #4
thirumalesh
Member
 
Registered: Sep 2007
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for ur reply


Actually my server will take max no of connections to be supported from a text file "parameters.txt"...

I just have to check the present connection number with this max no.
 
Old 02-18-2009, 11:46 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, again -

Have you considered just setting the "backlog" parameter when you call "listen()"?

a) You've already accepted() "n" connections
b) The TCP/IP stack is queuing another "m" connections (as determined by "backlog")
c) Any connections n + m + 1 will automatically be rejected: just like you wanted to do with WSAAccept()

Just a thought ..

PS:
I looked up this question in my old copy of "Unix Network Programming, 2nd Ed", W. Richard Stevens earlier this evening ... and I *didn't* find a solution there, either. Sorry :-(

Last edited by paulsm4; 02-18-2009 at 11:51 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wincrypt2.h analogous in linux thirumalesh Programming 1 02-12-2009 03:13 PM
Analogous functions for shell commands. anandsba Programming 3 12-07-2005 06:14 AM
autoexec.bat analogous for linux?.... amod Linux - Newbie 2 06-18-2003 05:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration