On Tuesday, December 21, 2010 6:39:26 am Mohammad Hedayati wrote: > I'm about to use a char device for a kind of distributed processing, > so I've coded the open function as follows. The problem is that > soaccept returns 0 without populating the raddr. I've checked netstat, > everything seems to be fine, the socket is created, bound and the > state is LISTENING. Even the remote is connection is ESTABLISHED. But, > it cannot receive anything. it says that socket (sock variable) is > not connected.
Yes, you are calling soaccept() on the wrong socket. You need to wait for a connection and dequeue the socket that connected and then call soaccept() on that new socket. Look at kern_accept() in sys/kern/uipc_syscalls.c. I wonder though if you wouldn't rather be calling soconnect instead? Do you really need to listen for new connections? -- John Baldwin _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"