.net - How Do I Create Packet Headers? -


basically i'm sending , receiving both images, strings , files on client/server connection. can use protocol string commands cannot distinguish between incoming data [if data image or whatever , follow onward instructions].

so how make packet using dim buffer byte() ?

i'm going take wild guess @ trying do. if using tcplistener handle incoming http connection respond so:

    private sub servepng()          dim stream networkstream = mytcpclient.getstream          dim content byte() = system.io.file.readallbytes("image.png")          dim sb new system.text.stringbuilder         sb.append("http/1.0 200 ok" + controlchars.crlf)         sb.append("content-type: image/png" + controlchars.crlf)         sb.append("content-length: " + content.length.tostring + controlchars.crlf)         sb.append(controlchars.crlf)          dim header() byte = encoding.ascii.getbytes(sb.tostring)         stream.write(header, 0, header.length)         stream.write(content, 0, content.length)          client.close()      end sub 

i'm getting byte array straight out of image.png


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -