__code sendDataRemoteDGMQueue(struct RemoteDGMQueue* cQueue, union Data* data, __code next(...), __code whenError(...)){ char recv_buf; int send_size, recv_size; send_size = send(cQueue->socket, data, sizeof(union Data), 0); if (send_size == -1) { printf("send error\n"); close(cQueue->socket); goto whenError(); } recv_size = recv(cQueue->socket, &recv_buf, 1, 0); if (recv_size == -1) { printf("recv error\n"); close(cQueue->socket); goto whenError(); } else if (recv_size == 0) { printf("connection ended\n"); close(cQueue->socket); goto whenError(); } else if(recv_buf == 0) { printf("Finish connection\n"); close(cQueue->socket); goto whenError(); } goto next(...); }