accept: Invalid argument

erkan kolemen erkankolemen at yahoo.com
Tue Sep 6 09:23:03 PDT 2005


you're right;

i added following before accept()
addrlen = sizeof(struct sockaddr);

>From manual:
therwise, the addrlen argument is a value-result
argument; it should initially contain the amount of
space pointed to by addr;

thanks

- erkan

--- victor cruceru <victor.cruceru at gmail.com> wrote:

> Also the 3rd argument for accept  must be positive.
> See man accept.
> victor cruceru.
> 
> On 9/6/05, victor cruceru <victor.cruceru at gmail.com>
> wrote:
> > Did you call bind() and especially listen() before
> accept()?
> > victor cruceru
> > 
> > 
> > On 9/6/05, erkan kolemen <erkankolemen at yahoo.com>
> wrote:
> > > Hi,
> > >
> > > In a daemon loop, i am using accept() to accept
> > > incoming connections.
> > >
> > > while(1) {
> > > if((fd = accept(socketd, (struct sockaddr *)
> &addr,
> > > &addrlen)) == -1) {
> > >   syslog(LOG_ERR, "accept: %s",
> strerror(errno));
> > >   continue;
> > > }
> > > else {
> > >  ...
> > > }
> > >
> > > accept always fails. What is wrong? i could
> create
> > > socket and i got a positive integer value as
> socket
> > > descriptor. following is from syslog:
> > >
> > > Sep  6 17:20:50 devel pro[99227]: accept:
> Invalid
> > > argument
> > > Sep  6 17:21:20 devel last message repeated
> 204686
> > > times
> > >
> > > What is wrong? i am calling accept before
> fork().. So
> > > i don't think child process affecting parent
> process.
> > >
> > > thanks and regards...
> > >
> > > - erkan
> > >
> > >
> > >
> > >
> > >
>
______________________________________________________
> > > Click here to donate to the Hurricane Katrina
> relief effort.
> > > http://store.yahoo.com/redcross-donate3/
> > > _______________________________________________
> > > freebsd-hackers at freebsd.org mailing list
> > >
>
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > > To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at freebsd.org"
> > >
> >
> 



	
		
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/


More information about the freebsd-hackers mailing list