vb.net - TCP listener receives huge data -
i have 2 application 1 server , other 1 client written in vb.net. both of them running on same machine ( using 127.0.0.1 ) client sends 5 bytes data server example: "farid" sever app has tcp listener receives huge data length of 65534 bytes. tried print received data , printed "farid" whith lots of empty spaces in front of sure tcp client sends right data, have no idea happens data when listener receives it.
the tutorial using has horrible practices , mistakes in it... =\
the receive loop in getmessage() should more like:
private sub getmessage() dim instream(10024) byte serverstream = clientsocket.getstream() while true dim bytesread integer = serverstream.read(instream, 0, instream.length) readdata = system.text.encoding.ascii.getstring(instream, 0, bytesread) msg() end while end sub
*using global string "readdata" pretty bad design though!
you should read article here closely: a peer-to-peer lan chat application in visual basic.net using tcpclient , tcplistener
Comments
Post a Comment