Click here to Skip to main content
16,005,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: STL Pin
Daniel Turini16-Mar-04 7:50
Daniel Turini16-Mar-04 7:50 
GeneralRe: STL Pin
Anonymous16-Mar-04 7:53
Anonymous16-Mar-04 7:53 
GeneralRe: STL Pin
Gary R. Wheeler16-Mar-04 14:17
Gary R. Wheeler16-Mar-04 14:17 
GeneralSTL Pin
RalfPeter16-Mar-04 5:33
RalfPeter16-Mar-04 5:33 
GeneralRe: STL Pin
Prakash Nadar16-Mar-04 5:58
Prakash Nadar16-Mar-04 5:58 
Generalownerdraw combox Pin
NikoTanghe16-Mar-04 3:33
NikoTanghe16-Mar-04 3:33 
GeneralRe: ownerdraw combox Pin
Neville Franks16-Mar-04 5:15
Neville Franks16-Mar-04 5:15 
GeneralCAsyncSocket: problem receiving data >1460 bytes Pin
stevedoulg90016-Mar-04 3:17
stevedoulg90016-Mar-04 3:17 
Hello,

I'm coding two apps that swap data (client / server) over TCP/IP, SOCK_STREAM, using my derived classes from CSocket and CAsyncSocket. Data is stored in a custom struct (size 3k) known to both apps.

Code snippet:


---- sending data using CSocket
tagDATA data; // data to send, its a struct
// use my derived CSocket to send:
m_Socket.Send (&data, sizeof (tagDATA));



----- receiving data using CAsyncSocket
void CMyAsyncSocket::OnReceive(int nErrorCode)
{
tagDATA data;

CAsyncSocket::OnReceive(nErrorCode);
int iRcvd = Receive (&data, sizeof(tagDATA));
// process data here...
}


It all works fine when both programs are running on the same machine, however when transmitting data over the network each 3k data block is chopped into chunks of size (1460 * i) bytes. 1460 seems to be the ethernet frame size.

The problem is of course that I wont receive correct tagDATA objects (I dont get all data with the first call to Receive() ), but instead several chunks for each one send. Is this normal socket behaviour? Will I have to reassemble the received chunks "by hand"? SO_RCVBUF is set to 8k by default. I cannot find any hint about max buffer size in MFC's CAsyncSocket::Receive documentation.

I tested this behaviour with MS MFCSocs example - it seems to behave similar: When sending approx 8k the data gets chopped into two bits (3k and 5k).

Any help is greatly appreciated,
Steve


GeneralRe: CAsyncSocket: problem receiving data >1460 bytes Pin
basementman16-Mar-04 4:00
basementman16-Mar-04 4:00 
GeneralRe: CAsyncSocket: problem receiving data >1460 bytes Pin
stevedoulg90016-Mar-04 4:13
stevedoulg90016-Mar-04 4:13 
GeneralRe: CAsyncSocket: problem receiving data >1460 bytes Pin
basementman16-Mar-04 4:16
basementman16-Mar-04 4:16 
GeneralRe: CAsyncSocket: problem receiving data >1460 bytes Pin
stevedoulg90016-Mar-04 4:23
stevedoulg90016-Mar-04 4:23 
GeneralRe: CAsyncSocket: problem receiving data >1460 bytes Pin
David Crow16-Mar-04 4:24
David Crow16-Mar-04 4:24 
GeneralSplitter in a CView Pin
#realJSOP16-Mar-04 2:57
professional#realJSOP16-Mar-04 2:57 
GeneralRe: Splitter in a CView Pin
David Crow16-Mar-04 3:04
David Crow16-Mar-04 3:04 
GeneralRe: Splitter in a CView Pin
basementman16-Mar-04 4:02
basementman16-Mar-04 4:02 
GeneralRe: Splitter in a CView Pin
#realJSOP16-Mar-04 4:23
professional#realJSOP16-Mar-04 4:23 
GeneralWarning message Pin
si_6916-Mar-04 2:49
si_6916-Mar-04 2:49 
GeneralRe: Warning message Pin
Mike Beckerleg16-Mar-04 3:00
Mike Beckerleg16-Mar-04 3:00 
GeneralFor MFC resource .dll Pin
nareshn216-Mar-04 2:35
nareshn216-Mar-04 2:35 
GeneralRe: For MFC resource .dll Pin
Prakash Nadar16-Mar-04 2:47
Prakash Nadar16-Mar-04 2:47 
GeneralRe: For MFC resource .dll Pin
nareshn216-Mar-04 2:57
nareshn216-Mar-04 2:57 
GeneralRe: For MFC resource .dll Pin
Steve S16-Mar-04 3:13
Steve S16-Mar-04 3:13 
GeneralPlaying wav through streaming buffer Pin
Sivaji16-Mar-04 2:32
Sivaji16-Mar-04 2:32 
Generalshould not open a file in the IE when i dragged it into activex control Pin
jillellamudi16-Mar-04 2:04
jillellamudi16-Mar-04 2:04 

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.