Hi, I am trying to create a client0server application and i need to create some shared memory for some procedures that all children have access (clients). My problem is that the system doesn't let me to create it.
Code:
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include "functions_Server.h"

int main() {

	int client_len, loc_socket, rem_socket;
	int shm_id;
    char* data;
	struct sockaddr addr;
	struct sockaddr client_addr;

  
	loc_socket=socket(AF_UNIX,SOCK_STREAM,0);	
	unlink(SOCKFILE);						
	bzero(&addr,sizeof(addr));			

	addr.sa_family=AF_UNIX;
	strcpy(addr.sa_data,SOCKFILE);	

	if (bind(loc_socket,&addr,sizeof(addr))<0)	{	
		printf("Server bind failure %d\n",errno);	
		perror("Server:");
		exit(1);
	}

	if (listen(loc_socket,LISTEN_Q)<0)	{			
		printf("Server listen failure %d\n",errno);	
		perror("Server:");							
		exit(1);									
	}

	//HERE IS MY PROBLEM
    shm_id= shmget(SHM_KEY, SHM_SIZE, 0600 | IPC_CREAT);
    if (shm_id!= 0) {
       printf("Could not create shared memory!\n");
       exit(1);
    }
     //HERE IS MY PROBLEM
    printf("/n%d/n",shm_id);

	for (;;)	{	
		if ((rem_socket=accept(loc_socket,&client_addr,&client_len))<0){
			printf("server accept failure%d\n",errno);
			perror("Server: ");
		}
		printf("\n%d\n",rem_socket);
	/*rest of code here */
		close(rem_socket);
	}

}
The program compiles just fine but when it gets to the part "HERE IS THE PROBLEM" it cant create the memory and it prints that corresponding message. My question is why cant it create it, what's wrong. I tried on UNIX and on UBUNTU but is the same