Still trying to understand the send() and recv() functions. Why isn't this working? Nothing prints out on the server output.(except for some Test "cout"s)
This is basically the part of the code I'm messing with.
CLIENT SIDE:
char *mesg_to_send;
Socket servSock;
mesg_to_send = The King is Dead!";
// Establish the connection to the echo server
if(connect(servSock, (struct sockaddr *) &srvr_addr, sizeof(srvr_addr)) < 0)
DieWithError("connect() failed");
send(servSock, (char*) mesg_to_send, sizeof(int), 0);
SERVER SIDE:
char *sentence;
Socket clnt_socket;
// Wait for the client to connect
if((clnt_socket = accept(srvr_socket, (struct sockaddr *) &clnt_addr, &addr_len)) < 0)
DieWithError("accept() failed");
recv(clnt_socket, (char*) sentence, sizeof(int), 0);
cout << sentence;