开发者

getting the actual bytes in a Socket (raw?)

Ok im pretty new in this networking stuff in .net especially in sockets. I've already "made" a proxy application and tried using it with my own local website (using wampserver) i selected few pictures that are around 60~k bytes of size yet i receive in my proxy counter around 15k "bytes", I have the feeling this is 开发者_开发百科the packets cause i'm using Socket.Send & Socket.Receive. Any help would do :)


Your problem is one of message framing. The Available property only reports the bytes that have arrived so far - not the complete HTTP request or response.

If this is just a learning exercise, then I recommend using another protocol. HTTP has one of the most complex message framing systems of any protocol.

If this is intended for production, then you'll have to implement (at least partial) HTTP parsing to handle the message framing, and I also recommend a change to asynchronous socket methods rather than synchronous. A better solution is to just implement a web application that uses WebRequest to handle client requests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜