[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Socket Buffer length

Posted on 1998-07-08
4
Medium Priority
?
469 Views
Last Modified: 2013-11-19
Is there any way to tell the length of the in-Buffer for a socket without disturbing the data in the buffer?
0
Comment
Question by:andy79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:andy79
ID: 1318874
Edited text of question
0
 
LVL 4

Accepted Solution

by:
piano_boxer earned 150 total points
ID: 1318875
You can get the number of bytes pending in the sockets inputbuffer by calling CAsyncSocket::IOCtl():

"FIONREAD Determine the maximum number of bytes that can be read with one Receive call from this socket. The lpArgument parameter points at a DWORD in which IOCtl stores the result. If this socket is of type SOCK_STREAM, FIONREAD returns the total amount of data which can be read in a single Receive; this is normally the same as the total amount of data queued on the socket. If this socket is of type SOCK_DGRAM, FIONREAD returns the size of the first datagram queued on the socket".

CSomeSocket sock;

DWORD dwBytesAvail = 0;
sock.IOCtl(FIONREAD, &dwBytesAvail);
0
 

Author Comment

by:andy79
ID: 1318876
I mean, the number of bytes in the buffer that are ready to be read.
0
 
LVL 4

Expert Comment

by:piano_boxer
ID: 1318877
Thats it!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question