Winsock - Clearing the buffer when .State=sckClosing 
Author Message
 Winsock - Clearing the buffer when .State=sckClosing

I've written an FTP server in VB, using Microsoft's Winsock control.  I'm
having a problem in that the FTP protocol signifies EOF by closing the
socket after sending all the file data.  Basically VB can't keep up with the
speed of the transfer, and when the remote side closes the connection, there
is still data in the buffer of the winsock control (the DataArrival event is
actually fired, and the BytesReceived parameter shows about 8k of data
waiting to be retrieved) but when I go to call .GetData, I get an 'Invalid
State' error.
I've tried using a standard winsock2 API call (recv) to get the data, but as
the winsock control is event driven, it is flagged as non-blocking and since
recv is a blocking call, it fails (the other suspicion I have is that before
the data arrival event is fired, the winsock control retrieves the data and
stores it within itself, so when I go to call recv there is no availible
data so it would block hence it fails).

Is there anyone with VB Winsock experience who has conquered this problem
before?  I'd think it must have been noticed as it's a fairly serious issue.
Any and all help would be appreciated.


Fri, 09 Jan 2004 07:12:07 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Winsock - Clearing the buffer when .State=sckClosing

2. VB6 MSWinSck.ocx Winsock.State=sckClosing

3. How can I Clear the Undo Buffer?

4. HOW do I clear the Keyboard Buffer???

5. Clearing the keyboard buffer

6. Clearing Print Buffer

7. clearing the keyboard buffer

8. Mouse Buffer Clear

9. How do you clear the keyboard buffer?

10. MCI wav Record How to clear buffer

11. Need to Clear Buffer?

12. Does Internet Explorer Clear the Keyboard Buffer?


Powered by phpBB® Forum Software