title: Sending multiple hex in array of bytes instead
body: <p>I have problem about socket to send multiple hex in one send to socket</p>
  
  <p>Here the detail :</p>
  
  <pre><code> Private Sub sendACK()
      Dim msgACK As String
      Dim sendBytes As Byte()
      tmpStr = ""
      list.Clear()
      msgACK = "33CC"
      For j = 1 To Len(msgACK)
          list.Add(Mid(msgACK, j, 2))
          j += 1
      Next
  
      For Each tmpStr In list
          sendBytes = HexToBytes(tmpStr)
          clientSocket.BeginSend(sendBytes, 0, sendBytes.Length, SocketFlags.None, New System.AsyncCallback(AddressOf OnSend), clientSocket)
      Next
   End Sub
  
  Public Function HexToBytes(ByVal s As String) As Byte()
      Dim bytes As String() = s.Split(" "c)
      Dim retval(bytes.Length - 1) As Byte
      For ix As Integer = 0 To bytes.Length - 1
          retval(ix) = Byte.Parse(bytes(ix), System.Globalization.NumberStyles.HexNumber)
      Next
      Return retval
  End Function
  
  Private Sub OnSend(ByVal ar As IAsyncResult)
      clientSocket = ar.AsyncState
      clientSocket.EndSend(ar)
      Thread.Sleep(100)
  End Sub
  </code></pre>
  
  <p>==> List as arraylist</p>
  
  <p>That code will be result : <br/>
  Socket send 33 <br/>
  end send<br/>
  Socket send CC <br/>
  end send<br/></p>
  
  <p>============================<br/>
  The program should be sending in one time like this :<br/>
  Socket send 33 CC <br/>
  end send<br/></p>
  
  <p>============================<br/>
  is there any idea about convert string "33CC" into byte and then that program just sending 1 time in outter "for each" ?</p>
  
  <p>thanks for reading and answering....<br/>
  GBU</p>