Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Learning VS 2005 C++ - recommendation Pin
Rolf Kristensen10-Jan-10 1:40
Rolf Kristensen10-Jan-10 1:40 
GeneralRe: Learning VS 2005 C++ - recommendation Pin
LunaticFringe10-Jan-10 1:53
LunaticFringe10-Jan-10 1:53 
GeneralRe: Learning VS 2005 C++ - recommendation Pin
Rolf Kristensen10-Jan-10 1:59
Rolf Kristensen10-Jan-10 1:59 
AnswerRe: Learning VS 2005 C++ - recommendation Pin
Denny10110-Jan-10 20:28
Denny10110-Jan-10 20:28 
GeneralRe: Learning VS 2005 C++ - recommendation Pin
Rolf Kristensen15-Jan-10 1:20
Rolf Kristensen15-Jan-10 1:20 
GeneralRe: Learning VS 2005 C++ - recommendation Pin
Denny10115-Jan-10 9:32
Denny10115-Jan-10 9:32 
QuestionWSAAsyncSelect and FD_WRITE Pin
zoopp9-Jan-10 0:35
zoopp9-Jan-10 0:35 
AnswerRe: WSAAsyncSelect and FD_WRITE Pin
Moak9-Jan-10 5:50
Moak9-Jan-10 5:50 
zoopp wrote:
Q1: Do i use FD_WRITE to communicate with the client application?


Maybe, but you don't have to use it. If you are sending (a lot of) data you might be interested in this event. It is used for handling partial sends, that is if you send more data then the socket can push over the network at a given time.

zoopp wrote:
Q2: FD_WRITE is triggered when the network buffer becomes full.


No, the opposite. If is triggered when the socket can be written to again (after a send with WSAEWOULDBLOCK), it tells you that the socket is ready to send more data. This is a simplified answer, it is also triggered in other cases, for the full documentation see MSDN[^]

zoopp wrote:
Q3: In order to fill it up I should make continuous calls to send() until i receive WSAEWOULDBLOCK.


Yes, until that happens or you have sent all your data. Data will be copied in the socket's send buffer first, the WSAEWOULDBLOCK case only arises if you pump in data faster than the socket can handle (lot of data or slow connection).

zoopp wrote:
Q3: Should i use the FD_READ event to send a response based on the data received from the client?


Maybe, you use this event instead of constantly polling the socket "is there more data for me? are there more bytes?". This event is triggered when the socket can be read, it tells you that the socket has more data.

For further reading have a look at examples, e.g. Winsock FAQ[^] (asynchronous sockets). Btw, I tried to simplify the answers... there is much more to talk about when it comes to efficient networking strategies.

Hope this helps and happy coding.
/M


GeneralRe: WSAAsyncSelect and FD_WRITE Pin
zoopp9-Jan-10 11:18
zoopp9-Jan-10 11:18 
GeneralRe: WSAAsyncSelect and FD_WRITE Pin
Moak9-Jan-10 12:00
Moak9-Jan-10 12:00 
QuestionHow to check if a tree is AVL tree? Pin
Cowork8-Jan-10 22:17
Cowork8-Jan-10 22:17 
QuestionRe: How to check if a tree is AVL tree? Pin
CPallini9-Jan-10 4:42
mveCPallini9-Jan-10 4:42 
AnswerRe: How to check if a tree is AVL tree? Pin
Cowork9-Jan-10 13:50
Cowork9-Jan-10 13:50 
GeneralRe: How to check if a tree is AVL tree? Pin
CPallini9-Jan-10 22:50
mveCPallini9-Jan-10 22:50 
AnswerRe: How to check if a tree is AVL tree? Pin
Saurabh.Garg9-Jan-10 14:30
Saurabh.Garg9-Jan-10 14:30 
Questionregular expression library for win32 api c or c++ Pin
Jayapal Chandran8-Jan-10 7:55
Jayapal Chandran8-Jan-10 7:55 
AnswerRe: regular expression library for win32 api c or c++ Pin
LunaticFringe8-Jan-10 8:57
LunaticFringe8-Jan-10 8:57 
GeneralRe: regular expression library for win32 api c or c++ Pin
Jayapal Chandran9-Jan-10 5:37
Jayapal Chandran9-Jan-10 5:37 
GeneralRe: regular expression library for win32 api c or c++ Pin
LunaticFringe9-Jan-10 11:56
LunaticFringe9-Jan-10 11:56 
GeneralRe: regular expression library for win32 api c or c++ Pin
Jayapal Chandran10-Jan-10 8:14
Jayapal Chandran10-Jan-10 8:14 
AnswerRe: regular expression library for win32 api c or c++ Pin
Graham Shanks8-Jan-10 10:39
Graham Shanks8-Jan-10 10:39 
AnswerRe: regular expression library for win32 api c or c++ Pin
Nemanja Trifunovic8-Jan-10 12:07
Nemanja Trifunovic8-Jan-10 12:07 
GeneralRe: regular expression library for win32 api c or c++ Pin
Jayapal Chandran9-Jan-10 5:39
Jayapal Chandran9-Jan-10 5:39 
QuestionQuestion about reading and writing to a file Pin
amichai228-Jan-10 6:25
amichai228-Jan-10 6:25 
AnswerRe: Question about reading and writing to a file PinPopular
amichai228-Jan-10 6:28
amichai228-Jan-10 6:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.