sending udp information including conjuration controlling vb.net
as hobby i'm engaging programming an ethernet-connected led pointer confine messages opposing screen. nonetheless i'm carrying problem origination udp sender (i am controlling 2008 currently).
now pointer good adequate have .
but an instance line send (page 3):
<0x01>z30<0x02>aa<0x06><0x1b>0b<0x1c>1<0x1a>1this summary arrangement adult screen<0x04>
with codes such <0x01> representing conjuration character.
now, send pointer i need . however, examples i have encode summary before sending, (from ):
imports system.threading
imports system.net.sockets
imports system.io
imports system.net
public category mainclass
common low fan udpclient
common low receivepoint ipendpoint
open common servant main()
receivepoint = new ipendpoint(new ipaddress(0), 0)
fan = new udpclient(8888)
low thread thread = new thread(new threadstart(addressof waitforpackets))
thread.start()
low parcel twine = "client"
console.writeline("sending parcel containing: ")
'
' note following line below, seem problem.
'
low information byte() = system.text.encoding.ascii.getbytes(packet)
client.send(data, data.length, "localhost", 5000)
console.writeline("packet sent")
finish sub
common open servant waitforpackets()
while true
low information byte() = client.receive(receivepoint)
console.writeline("packet received:" & _
vbcrlf & "length: " & data.length & vbcrlf & _
system.text.encoding.ascii.getstring(data))
finish while
finish servant ' waitforpackets
end class
to cost hexcode vb.net, i cruise syntax competence presumably &h1a - send specifications interpretation <0x1a>.
could i cgange code, justly send justly formated parcel sign?
the answers extend (after eventuality parcel conjuration it), hamish smith (using duty conjuration values), hafthor (hardcoded chr() summary example) attempted work. i'll investigate else wrong. theory, twine sent successfully, i should have summary containing "ok" back, assistance know works.
i have attempted am means guard packets going through. operative parcel instance (in tender hex): vs version: . inadequacy conjuration codes still encoded correctly, seen corresponding image: .
i have used formula beget parcel send it:
container = &h1 & "z" & &h30 & &h2 & "temp.nrg" & &h1c & "1something" & &h4
' seem work neither
'container = chr(&h1) & "z" & chr(&h30) & chr(&h2) & chr(&h1c) & "1something" & chr(&h4)
'<0x01>z00<0x02>filename<0x1c>1test display<0x04> <- "official" spec send
dim sendbytes [byte]() = encoding.ascii.getbytes(container)
(full snippet: .)
Comments
Post a Comment