Uzywam Dev-C++ oraz kompilatora BC5.5 i jednoczesnie przy binodwaniu portu GDB pokazuje mi SIGSEGV czyli blad segmentacji ale czemu??
void bzero(char *t, unsigned int max) {
for (register unsigned int i = 0; i < max; i++
*(t + i) = '\0';
}
//--------------------------
int main(void){
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 0); // Request WinSock v2.0
if (WSAStartup(wVersionRequested, &wsaData) != 0) { // Load WinSock DLL
perror("WSAStartUp");
exit(1);
}
// create the descriptor to socket
int socket_descriptor;
//create the variables to store the address of local machine and server
struct sockaddr_in local_addr, server_addr;
//create the buffer
char msg[BUFFER_SIZE];
//
printf("Client>creating the socket(AF_INET 'IP', STREAM, UDP)...");
//create the socket
socket_descriptor = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
// check if this socket was well created
if ( socket_descriptor < 0 )
{
printf("[aborted]\n");
perror("[error - failure in the socket creation]\n");
exit(1);
}
printf("[OK]\n");
//initialize the address and port for client
bzero( (char *) &local_addr, sizeof(local_addr));
local_addr.sin_family = AF_INET;
local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
local_addr.sin_port = htons(CLIENT_PORT);
//
printf("Client>binding the socket...");
//make and check the bind between the socket
// and the local address and local port
if( bind(socket_descriptor, (struct sockaddr *) &local_addr, sizeof(local_addr) ) ) {
printf("[aborted]\n");
perror("[error - failure in the socket binding]\n");
exit(1);
}
printf("[OK]\n");
.....
i GDB mi pokazuje ze na BIND jest SIGSEGV..
;( pomozcie prosze