Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int server_socket = socket(AF_INET, SOCK_STREAM, 0);
- //connecting to the server with connect function
- send(server_socket, &datalength, sizeof(datalength)); //datalength is an integer containing the number of bytes that are going to be sent next
- send(server_socket, actual_data, sizeof(actual_data)); //actual data is a char array containing the actual character string data
- int server_socket = socket(AF_INET, SOCK_STREAM, 0);
- //bind the socket to the ip and port with bind function
- //listen to the socket for any clients
- //int client_socket = accept(server_socket, NULL, NULL);
- int bytes;
- recv(client_socket, &bytes, sizeof(bytes);
- char* actual_message = malloc(bytes);
- int rec_bytes = recv(client_socket, actual_message, bytes);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement