I'm learning about the networking aspects of .NET for the first time, and I have a question on buffer size. What impact does the size have? The example below from MSDN uses 1024 while some other examples I've seen use different sizes. Would a smaller buffer retrieve smaller chunks of data at once?
Code:Dim handler As Socket = listener.Accept() data = Nothing ' An incoming connection needs to be processed. While True bytes = New Byte(1024) {} Dim bytesRec As Integer = handler.Receive(bytes) data += Encoding.ASCII.GetString(bytes, 0, bytesRec) If data.IndexOf("<EOF>") > -1 Then Exit While End If End While




Reply With Quote