Click here to Skip to main content
16,012,166 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How can I know how many message are pending (for receiving) on my socket?
I'm useing winsock.
Please help me.
Posted
Updated 9-Sep-10 0:03am
v2
Comments
Dalek Dave 9-Sep-10 6:03am    
Minor Edir for Grammar.

First, there's no such thing as "pending" messages. If the socket is busy, any incoming requests are refused. What you need to do is have a thread that monitors the port, and immediately buffers incoming data, and then another thread that processes the data in the buffer. Once you implement this model, you can determine how large the buffer is.
 
Share this answer
 
Comments
patilvaibhavrao 9-Sep-10 6:00am    
I want to How many Message are comming on my socket & how many message i recived from it
Have a look at this article: C++ Winsock Client To Server File Transfer - Made Easy[^]

Further tutorial on WinSock in C++ here[^].
 
Share this answer
 
Comments
patilvaibhavrao 9-Sep-10 5:59am    
i want know how many message are comming on my socket & how many i recived from it
Sandeep Mewara 9-Sep-10 6:08am    
I still don't get it, when socket can take message, it will. As JSOP, above already explained a model where you can monitor stuff == have a count of all data kinda thing.
patilvaibhavrao 9-Sep-10 6:43am    
suppose i m getting continuesly getting the message i.e.100 per sec. & i have capacity to recive ony 50 message per sec. the i want to know how many messages on my socket & how many message i m recived.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900