Socket flushing in VB (winsock) 
Author Message
 Socket flushing in VB (winsock)

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


Sat, 30 Jul 2005 02:55:35 GMT  
 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



Sat, 30 Jul 2005 11:52:14 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Flush socket / EOF

2. (VB,Winsock) Extracting data from socket.

3. (VB,Winsock) Extracting data from socket.

4. Winsock Socket Error from embedded VB Form

5. Winsock not flushing data

6. Solution: Winsock Does Not Flush Buffer Correctly

7. winsock control: buffer flushing?

8. winsock control: buffer flushing?

9. .NET Socket vs VB6 Winsock problem!

10. Winsock / Sockets

11. Visual Basic 4 Socket communication (WinSock) Need Help!

12. Winsock.bas Closing Socket?

 

 
Powered by phpBB® Forum Software