Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket handling and WIN32 WSACleanup fixes #3663

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/examples/externalsocket.c
Expand Up @@ -124,8 +124,10 @@ int main(void)
servaddr.sin_port = htons(PORTNUM);

servaddr.sin_addr.s_addr = inet_addr(IPADDR);
if(INADDR_NONE == servaddr.sin_addr.s_addr)
if(INADDR_NONE == servaddr.sin_addr.s_addr) {
close(sockfd);
return 2;
}

if(connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) ==
-1) {
Expand Down Expand Up @@ -157,10 +159,16 @@ int main(void)

curl_easy_cleanup(curl);

close(sockfd);
andyguibert marked this conversation as resolved.
Show resolved Hide resolved

if(res) {
printf("libcurl error: %d\n", res);
return 4;
}
}

#ifdef WIN32
WSACleanup();
#endif
return 0;
}