Skip to content

Client disconnect method in sockets

chikki manthri

Asked Apr 9, 2008, 1:47 AM EDT2 answers
Share
LinkedInX

i have written a server program in c# (sockets) to read a client  using asynchronous method. but i'am unable to know when the client is disconnected.

      one method is to see if number of bytes received are zero then the client is disconnected,but as my program is asynchronous i'am unable poll the client's status.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    Take a look on this article  may be it brings you some help 
    0
  • 0

    thannks for the artical,but when i use

    [DllImport("wininet.dll", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]

     

    i'am getting the error as

    Error 1 The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?) .

     

    what may be the reason

    0