Some days I am sure that I am going mad. Other days I am confident I am. I am not sure which case today falls into, but it is one of them. I am trying to send some data from my computer out the network port. This should be simple. I wanted to send two packets out. One for instance contained the value 1, and the other contained the value 2. So I write some code, and it does not work. Even worse, when I use Ethereal to check on what is happening I find that I am sending packets containing ‘2’ twice. This SHOULD NOT be happening.

Dim Buffer(1) As Byte
Buffer(0) = 1
Send(Buffer, d.RemoteEndPoint)
Buffer(0) = 2
Send(Buffer, d.RemoteEndPoint)

And it was sending both as ‘2’. Very strange. When I changed the VB.NET code to the following things started workng.

Dim Buffer(1) As Byte
Buffer(0) = 1
Send(Buffer, d.RemoteEndPoint)
Dim Buffer2(1) As Byte
Buffer2(0) = 2
Send(Buffer2, d.RemoteEndPoint)

Since SEND is getting the packets ‘By Value’, I should not need to do this. Not sure what is going on, but it is a BUG!