LinuxQuestions.org
Review your favorite Linux distribution.
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 01-19-2004, 05:34 PM   #1
krajzega
Member
 
Registered: Jan 2004
Location: Poland
Distribution: FreeBSD 5.1
Posts: 92

Rep: Reputation: 15
Function accept() and its arguments.


In a few manuals to programming sockets for Linux, I found this function. And everywhere is written that it expects int as a third argument- total size of a structure sockaddr_in. But no way. Gcc returns, that this function excepts the argument as a member of structure socklen_t. Could You write me a right call of this function and declaration of this argument ?

Last edited by krajzega; 01-19-2004 at 06:25 PM.
 
Old 01-20-2004, 01:26 AM   #2
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
sockelen_t is #define'd to int,


main()
{
....
...
struct sockaddr_in peer;
int size;

...socket(AF_INET, SOCK_STREAM, 0);

....bind(sockfd, ......);
listen(sockfd, .....);
size = sizeof(struct sockaddr_in);
new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &size);
....
......

this should do...
try doing a man 2 accept , too
 
  


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
How to pass structure as function arguments ssg14j Programming 2 08-20-2005 09:59 PM
How to import arguments to system() function skie_knite007 Programming 5 03-25-2005 08:49 PM
Python function arguments are dictionaries? johnMG Programming 1 07-24-2004 06:29 PM
C Function Arguments jpbarto Programming 6 04-23-2004 01:59 PM
Perl: Getting a script to accept arguments JStew Programming 10 03-10-2003 06:56 AM

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

All times are GMT -5. The time now is 05:30 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