
Socket flushing in VB (winsock)
In TCP, there is no such conceptual thing as a "packet". The data is
conceptually a single stream. Although it gets broken up into packets on the
lower layers, you have no control over them individually.
If you want packetized communication, switch to a packet/datagram oriented
protocol (such as UDP), or implement your own packetized protocol on top of
TCP. Doing the latter can be as simple as sending a Long containing the
number of bytes that comprise the next packet.. When sending data, send the
length and then the data. When recieving, read the length and then read that
many bytes into a buffer.
Murphy McCauley
www.constantthought.com
Quote:
> I am writing a HTTP tunneling application in VB. I am sending a
> "connect" packet to the proxy, which uses this packet to set up a
> socket connection to the destination. I then need to send an
> authentication packet to the destination which the proxy forwards on.
> I am doing these 2 writes using Socket.SendData(). However, I am
> running into the issue of both the above 2 buffers being put into one
> single packet even though I am calling Socket.SendData() twice. Is
> there something that I should differently to force the first
> Socket.SendData() to send the things that are present at in the
> buffer? I would really appreciate any help.
> Regards,
> Bharath Beedu