c# - WebClient.DownloadString is 12 times faster than TcpClient? -



c# - WebClient.DownloadString is 12 times faster than TcpClient? -

it 8 hours , still trying figure out. code examples in vb.net think readable c# users. oh, , take c# solutions too.

this takes maximum 50ms:

dim info string = wc.downloadstring("x.com")

while takes 600ms average:

dim client new net.sockets.tcpclient client.nodelay = true client.client.nodelay = true client.connect(ip, 80) dim ns net.sockets.networkstream = client.getstream dim gbytes(70000) byte ns.write(rbytes, 0, rbytes.length) ns.flush() ns.read(gbytes, 0, gbytes.length) dim info string = system.text.encoding.ascii.getstring(gbytes)

yes, have tried stream reader, diffrent buffer sizes including less , more length of response(which 100,000 bytes). using same headers used webclient , tried diffrent headers too. have tried every combination of nodelay.

the thing is, don't want utilize webclient , networkstream.flush commented useless in .net there way out?

c# vb.net sockets webclient networkstream

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -