این اسم کتابشه
Windows Sockets Network Programming

by Bob Quinn and Dave Shute
Addison-Wesley Publishing Company, November 1995
637 pp., with source code on 3.5" disk
ISBN 0-201-63372-8
$54.99 list, $50.04 at Amazon.com (click to purchase)

Book reviewed 9/7/1998

http://www.codeproject.com/KB/dotnet...ctionLoss.aspx










The Examples





 
Try

Dim ReceivedBytes As Integer

Dim tmpBuffer As Byte()

ReDim tmpBuffer(1024)



While blActive And Socket.Connected

' Resetting received bytes

tmpBuffer.Clear(tmpBuffer, 0, tmpBuffer.Length)

' Getting new bytes

ReceivedBytes = Socket.Receive(tmpBuffer, 0, tmpBuffer.Length, Sockets.SocketFlags.None)

' Note: monitoring the blActive member as socket might have been closed prior the this point

If ReceivedBytes > 0 And blActive Then

' Your code here to handle the new data

DataReceived_Handler(tmpBuffer) ' <- Your handler

Else

' if returned with 0 bytes, that means the connection is lost
' Use your personalized code to handle the closure of the connection
yourCloseSocket() ' close the connection

End If



End While