Chatgpt writes a hello world program using Shakespeare English.
submitted 1 year ago by DONKEYBALOGNA from (i.imgur.com)
view the rest of the comments →
[–]DONKEYBALOGNA[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - 1 year ago (0 children)
It wrote a basic web server program but did not process https secure requests
int main(void) { int socket_desc, client_sock, c, read_size; struct sockaddr_in server, client; char client_request[MAX_REQUEST_LENGTH];
// Create socket socket_desc = socket(AF_INET, SOCK_STREAM, 0); if (socket_desc == -1) { printf("Could not create socket\n"); return 1; }
// Prepare the sockaddr_in structure server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(443);
// Bind the socket to port 443 if (bind(socket_desc, (struct sockaddr *)&server, sizeof(server)) < 0) { printf("Bind failed\n"); return 1; }
// Listen for incoming connections listen(socket_desc, 3);
// Accept incoming connections printf("Waiting for incoming connections...\n"); c = sizeof(struct sockaddr_in); client_sock = accept(socket_desc, (struct sockaddr *)&client, (socklen_t *)&c); if (client_sock < 0) { printf("Accept failed\n"); return 1; }
// Receive client request memset(client_request, 0, sizeof(client_request)); read_size = recv(client_sock, client_request, MAX_REQUEST_LENGTH, 0); if (read_size == 0) { printf("Client disconnected\n"); } else if (read_size == -1) { printf("Receive failed\n"); }
// Display the incoming header request printf("Incoming header request:\n%s", client_request);
// Clean up close(socket_desc); close(client_sock);
return 0; }
use the following search parameters to narrow your results:
e.g. sub:pics site:imgur.com dog
sub:pics site:imgur.com dog
advanced search: by author, sub...
~5 users here now
view the rest of the comments →
[–]DONKEYBALOGNA[S] 2 insightful - 1 fun2 insightful - 0 fun3 insightful - 0 fun3 insightful - 1 fun - (0 children)