N
ninadsd
I have the following VB6 code
-------------------------------------
Option Explicit
Const ByteCode = "ÿÿÿÿ"
Private Sub Form_Load()
wsk.Protocol = sckUDPProtocol
wsk.RemoteHost = "255.255.255.255"
wsk.RemotePort = 27015
wsk.SendData ByteCode & "infostring"
End Sub
Private Sub wsk_DataArrival(ByVal bytesTotal As Long)
Dim strReceived As String
wsk.GetData strReceived
MsgBox (strReceived)
End Sub
---------------------------------------
I get the required result. I was trying the same in VB.NET but
unsuccessful.
---------------------------------------
Dim udpClient As New UdpClient
Const ByteCode = "ÿÿÿÿ"
udpClient.Connect("255.255.255.255", 27015)
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(ByteCode &
"infostring")
udpClient.Send(sendBytes, sendBytes.Length)
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
Dim receiveBytes As [Byte]() =
udpClient.Receive(RemoteIpEndPoint)
Dim returnData As String =
Encoding.ASCII.GetString(receiveBytes)
-------------------------------------
Option Explicit
Const ByteCode = "ÿÿÿÿ"
Private Sub Form_Load()
wsk.Protocol = sckUDPProtocol
wsk.RemoteHost = "255.255.255.255"
wsk.RemotePort = 27015
wsk.SendData ByteCode & "infostring"
End Sub
Private Sub wsk_DataArrival(ByVal bytesTotal As Long)
Dim strReceived As String
wsk.GetData strReceived
MsgBox (strReceived)
End Sub
---------------------------------------
I get the required result. I was trying the same in VB.NET but
unsuccessful.
---------------------------------------
Dim udpClient As New UdpClient
Const ByteCode = "ÿÿÿÿ"
udpClient.Connect("255.255.255.255", 27015)
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(ByteCode &
"infostring")
udpClient.Send(sendBytes, sendBytes.Length)
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
Dim receiveBytes As [Byte]() =
udpClient.Receive(RemoteIpEndPoint)
Dim returnData As String =
Encoding.ASCII.GetString(receiveBytes)