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

Projects
None yet
3 participants
@andyguibert
Copy link

commented Mar 11, 2019

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 some commits Mar 11, 2019

Andre Guibert de Bruet
This commit corrects a missing call to close() against sockfd and add…
…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().
Andre Guibert de Bruet
Add missing WSACleanup() call, 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().
Show resolved Hide resolved docs/examples/externalsocket.c
@bagder

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Author

commented Mar 12, 2019

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

This comment has been minimized.

Copy link
Member

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.
You can’t perform that action at this time.