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

Conversation

andyguibert
Copy link

Just a couple of nitpicks in docs/examples/externalsocket.c:

In the event that servaddr.sin_addr.s_addr is INADDR_NONE, the example code leaks sockfd. This would matter if someone copied the code into a function that wasn't main()... ;-)

Microsoft's Winsock documentation states that a matching call to WSACleanup() should be called for every WSAStartup() call performed.

Andre Guibert de Bruet added 2 commits March 10, 2019 23:15
…s a missing call to WSACleanup() in the WIN32

case, per Microsoft's Winsock2 documentation:
   https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsacleanup

WSACleanup() should ideally be called before any return from main() that occurs after the call to WSAStartup().
   https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsacleanup

WSACleanup() should ideally be called before any return from main() that occurs after the call to WSAStartup().
docs/examples/externalsocket.c Show resolved Hide resolved
@bagder
Copy link
Member

bagder commented Mar 11, 2019

Try make checksrc in the examples dir:

./externalsocket.c:163:4: warning: Trailing whitespace (TRAILINGSPACE)
     
    ^
checksrc: 0 errors and 1 warnings

@andyguibert
Copy link
Author

Try make checksrc in the examples dir:

./externalsocket.c:163:4: warning: Trailing whitespace (TRAILINGSPACE)
     
    ^
checksrc: 0 errors and 1 warnings

Corrected. Thanks!

@jay jay closed this in 57c7076 Mar 12, 2019
@jay
Copy link
Member

jay commented Mar 12, 2019

Thanks

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants