CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2001
    Location
    israel
    Posts
    99

    Failed to close socket connection

    hi,

    i am using a Winsock control in my application.
    i wrote some lines of code in the Close event of the control but when i activate the Close function it doesn't close the connection and dont get into the Close event.

    is that a common problem? any idea how to solve it?

    thank,
    ohad.


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: Failed to close socket connection

    somehow even we close it but winsock has an option called LINGER which determine the behaviour of the shutdown.... In VC++, CSocket can't control it, only CAsyncSocket can... I think winsock control should be similar to CSocket... but winsock control expose a property - SocketHandle which can be used with API.

    I used to use the following code to make sure it really close..


    Do While winsock1.State <> sckClosed
    HTTPWS.Close
    DoEvents
    Loop








    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured