Hi everybody.
I need to pass the value of a pointer to a struct for a server program to a client program.
my code is the following
for the server:
write(ns, &fixedparkpnt, sizeof(fixedparkpnt));
write(ns, &fixeddriverpnt, sizeof(fixeddriverpnt));
and for the client:
read(sock2, &fixedparkpnt, sizeof(fixedparkpnt));
read(sock2, &fixeddriverpnt, sizeof(fixeddriverpnt));
sock2 is the socket for the comunication and fixedparkpnt and fixeddriverpnt are the pointers to the structs named parking and customer accordingly. the structs are in shared memory segments. after the read() commands i have a
printf("Data recieved\n");
for debugging purposes and the client prints it. when i ask it to print (*fixedparkpnt).name (member of the struct parking) it gives me a segmentation fault