1. Question: Problem with socket, socket system call returns 0
Hi,
Ok my problem is this I have tried to bind a socket but the bind
system call
return -1 and errno is set to 88 (it is not a valid socket descriptor).
Debugging my piece of code I have discovered that before the socket
system call returns 0. Is this a valid socket
descriptor ? I' m working as not root user and I have tried to bind the
socket on different ports for example 6969 etc..
The piece of code is something like this:
#include<stdio.h>
......
.....
sockaddr_in addr;
int main() {
.......
........
if ((sock = (AF_INET, SOCK_STREAM, 0)) == -1) {
fprintf(stderr, "Socket creation error errno is %i\n", errno);
return -1;
}
/* from now sock is = 0 */
addr.sin_family = AF_INET;
addr.sin_port = htons(6969);
addr.sin_addr.s_addr = INADDR_ANY;
bzero(&(addr.sin_zero), 8);
if ((bind(sock, (struct sockaddr *)&addr, sizeof(sockaddr_in))) ==
-1) {
fprintf(stderr, "Binding error errno is %i\n", errno);
return -1;
/* Here the program exit with errno set to 88 */
}
return 0;
Thanks to everyone can help me
Cris
2. What Should I do now?
3. Problem: getpeername: Socket operation on non-socket
4. Is my SCSI Card compatable?
5. Soundex fingerd + NIS server anyone?
6. problem with socket code (well, it uses socket libraries anyway)
7. Is it safe to mount /usr/spool/mail?
8. Problems in socket
9. Problem on Sockets
10. a basic problem about socket and select
11. Problems with socket
12. Problem with socket closure in 2.2 kernel?