Click here to Skip to main content
15,926,256 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thread func Pin
Daniel Lohmann7-Aug-02 3:24
Daniel Lohmann7-Aug-02 3:24 
GeneralRe: Thread func Pin
[CoY0te]7-Aug-02 2:36
[CoY0te]7-Aug-02 2:36 
GeneralRe: Thread func Pin
Daniel Lohmann7-Aug-02 3:30
Daniel Lohmann7-Aug-02 3:30 
GeneralBitmap Pin
anuprasad6-Aug-02 23:43
anuprasad6-Aug-02 23:43 
GeneralRe: Bitmap Pin
Tomasz Sowinski7-Aug-02 0:21
Tomasz Sowinski7-Aug-02 0:21 
GeneralAudio support Pin
jayostu6-Aug-02 23:01
jayostu6-Aug-02 23:01 
GeneralApplication Shutdown problem Pin
Anonymous6-Aug-02 22:52
Anonymous6-Aug-02 22:52 
GeneralCAsyncSocket Question Pin
Niko Tanghe6-Aug-02 22:48
Niko Tanghe6-Aug-02 22:48 
Hi there,

I need to send a message to a UDP or TCP client.
The function needs to be synchronic.

I the following code 'good practice' ?
When does Send() or SendTo() return WSAEWOULDBLOCK ?

Greetings,

Niko

bool CSomeClass::SendMessage(BYTE *lpBuf, int iBufLen)
{
if (GetConnectionType() == eTCP)
{
if(!m_pSocket)
return false;

int iBytesSend = 0;
while (iBytesSend < iBufLen)
{
iBytesSend += m_pSocket->Send(lpBuf+iBytesSend, iBufLen-iBytesSend);

if (iBytesSend == SOCKET_ERROR)
return false;
}

return true;
}
else if (GetConnectionType() == eUDP)
{
//Use Server socket to send UDP Message
int iBytesSend = 0;
while (iBytesSend < iBufLen)
{
iBytesSend += m_pServerSocketUDP->SendTo(lpBuf+iBytesSend, iBufLen-iBytesSend,
m_uiPeerPortConnection, m_csPeerNameConnection);

if (iBytesSend == SOCKET_ERROR)
return false;
}

return true;
}

return false;
}
GeneralRe: CAsyncSocket Question Pin
Jon Hulatt7-Aug-02 1:47
Jon Hulatt7-Aug-02 1:47 
GeneralRe: CAsyncSocket Question Pin
Niko Tanghe7-Aug-02 1:55
Niko Tanghe7-Aug-02 1:55 
GeneralRe: CAsyncSocket Question Pin
Masaaki Onishi7-Aug-02 6:48
Masaaki Onishi7-Aug-02 6:48 
GeneralCLOCKS_PER_SEC Pin
Janette6-Aug-02 21:51
Janette6-Aug-02 21:51 
GeneralRe: CLOCKS_PER_SEC Pin
[CoY0te]6-Aug-02 23:45
[CoY0te]6-Aug-02 23:45 
GeneralRe: CLOCKS_PER_SEC Pin
_Magnus_6-Aug-02 23:47
_Magnus_6-Aug-02 23:47 
GeneralRe: CLOCKS_PER_SEC Pin
Haakon S.7-Aug-02 3:22
Haakon S.7-Aug-02 3:22 
GeneralLoading Bitmaps in Dialog Pin
Shibu6-Aug-02 21:40
Shibu6-Aug-02 21:40 
GeneralRe: Loading Bitmaps in Dialog Pin
Tomasz Sowinski7-Aug-02 0:25
Tomasz Sowinski7-Aug-02 0:25 
GeneralRe: Loading Bitmaps in Dialog Pin
Anonymous7-Aug-02 1:18
Anonymous7-Aug-02 1:18 
Generalmessagebox like dialogbox Pin
slah6-Aug-02 21:22
slah6-Aug-02 21:22 
GeneralRe: messagebox like dialogbox Pin
Tomasz Sowinski7-Aug-02 0:28
Tomasz Sowinski7-Aug-02 0:28 
GeneralIE View Source Data Pin
Paul M Watt6-Aug-02 21:05
mentorPaul M Watt6-Aug-02 21:05 
GeneralRe: IE View Source Data Pin
Paul M Watt7-Aug-02 6:46
mentorPaul M Watt7-Aug-02 6:46 
GeneralRe: How about Socket program? Pin
Masaaki Onishi7-Aug-02 7:09
Masaaki Onishi7-Aug-02 7:09 
GeneralRe: How about Socket program? Pin
Paul M Watt7-Aug-02 19:20
mentorPaul M Watt7-Aug-02 19:20 
GeneralRe: IE View Source Data Pin
Todd Smith7-Aug-02 7:56
Todd Smith7-Aug-02 7:56 

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.