are there ways send besides strings through tcplistener? because of examples have seen far involve encoding string array of bytes, sending through, , decoding on other side.
encoding.ascii.getbytes("message"); //this sent array of bytes what if wanted send float through, or int through, or else? involve 'converting' object array of bytes , sending over?
[edit] apologize if stupid question, i'm trying learn more networking here.
depends, if can attach binarywriter networkstream, can stuff like:
static void servertask(object clnobj) { tcpclient client = clnobj tcpclient; binarywriter bw = new binarywriter(client.getstream()); int k =99; bw.write(k); client.close(); } but when sending in binary should careful things endianness. floats, important encoding, must same on receiving , sending parts. think binaryreader, binarywriter handle these (e.g., endianness fixed).
in end being sent array of bytes. binarywriter abstraction here, , work converting integer array of bytes.
Comments
Post a Comment