printf("what is your name?");
gets(send_name);
strcpy(send_name2, strcat("You are connected to ", send_name));
send(connected, send_name2, strlen(send_name2), 0);
The other executable is not receiving what i sent…
nbytes_recieved = recv(sock, recv_name, 50 ,0);
recv_name[nbytes_recieved] = '\0';
This is the code I used in the client code to let it receive the string.
Thanks,
Sidd
strcatexpects as its first argument a writeable buffer. What you give to it is a constant string, probably stored somewhere in a read-only area of the process. The function attempts to write right after this constant string, which results in a memory access violation.