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 2 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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) {
@@ -157,10 +159,16 @@ int main(void)

curl_easy_cleanup(curl);

close(sockfd);
This conversation was marked as resolved by andyguibert

This comment has been minimized.

Copy link
@jay

jay Mar 11, 2019

Member

easy cleanup closes the socket, i believe that happens in all cases

This comment has been minimized.

Copy link
@bagder

bagder Mar 11, 2019

Member

Well, then the close callback gets called since CURLOPT_CLOSESOCKETFUNCTION is used by the example, which (for some reason) doesn't close the socket! So I think adding a close is ok.

But doesn't windows use closesocket() for this?

This comment has been minimized.

Copy link
@jay

jay Mar 11, 2019

Member

Well, then the close callback gets called since CURLOPT_CLOSESOCKETFUNCTION is used by the example, which (for some reason) doesn't close the socket! So I think adding a close is ok.

ah ok. maybe that makes more sense since it's opened externally.

But doesn't windows use closesocket() for this?

close maps to closesocket in the example so it's fine.


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

#ifdef WIN32
WSACleanup();
#endif
return 0;
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.