ok this is a real sockets n00b question...
My code...
the send always fails and returns the error "Socket operation on non-socket", when i print newFD it is 0.Code:if ( newFD = accept( scktFD, (struct sockaddr *)&client_addr, &sin_size ) == -1 ) { perror( "connection_listen: accept" ); close( scktFD ); exit( EXIT_FAILURE ); } if (( send( newFD, "Hello world", 11, 0 )) == -1 ) { perror( "send" ); close( newFD ); exit( EXIT_FAILURE ); }
I thought that was valid and i couldnt find a problem until i found this..
in /net/unix/af_unix.c[NOT TO FIX]
60 * accept() returns a path name even if the connecting socket has closed
61 * in the meantime (BSD loses the path and gives up).
62 * accept() returns 0 length path for an unbound connector. BSD returns 16
63 * and a null first byte in the path (but not for gethost/peername - BSD bug ??)
Anyway I have no idea what is going wrong or if I am using accept the wrong way. Any pointers would be great.



LinkBack URL
About LinkBacks


