|
Dear All,
I am doing a sockets program where the recv() fn receives only 75000 bytes. But I am sending around 1,25,130 bytes.
What could be the reason ?
Can any one help me on this.
Thanks
Nice things do nice works
|
|
|
|
|
well thats how sockets work i guess... there is no guarantee recv() will get the exact same number of bytes that send() sent....you will probably have to call recv() multiple times to get all the data.....
you can find this sort of thing done at: http://www.codeproject.com/internet/SocketFileTransfer.asp
|
|
|
|
|
Sakthiu wrote: I am doing a sockets program where the recv() fn receives only 75000 bytes. But I am sending around 1,25,130 bytes.
What could be the reason ?
if this is the problem, why don't you break files into small frames and send it one by one.. just like sliding window protocol work
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
I suggest reading the specs for recv() carefully
Assuming you are using TCP -
Any recv() call is successful if it receives at least 1 byte. Beyond that there's no guarantee
you'll get the number of bytes you request.
In this case there was probably more bytes sent than could fit in the socket's receive buffer
so the first call to recv() will return as many bytes are available in the buffer which will
make room for the socket to receive more bytes. You'll need subsequent calls to recv() to
get the rest.
Mark
|
|
|
|
|
I know this should be simple, but I really don't get what's not working.
After two hours of research the best answer i found was to do this:
//Show form fAbout from form Form1
fAbout fForm = new fAbout();
fForm->Show(1);
I also added #include "About.h" in the Form1.cpp
The name of the form in About.h is fAbout and I always get the error C2065: 'fAbout' : undeclared identifier.
I'd like to know what i'm doing wrong here.
|
|
|
|
|
http://functionx.com/visualc/howto/calldlgfromdlg.htm
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
That doesn't work. Maybe the fact that i'm using a mix of mfc and managed c++ doesnt help(I know it's a bad idea so dont say it), but it's almost the same as I already did exept the functions are in the .cpp instead of the .h and i'm not using dialog box.
-- modified at 0:43 Wednesday 10th January, 2007
Found the problem. Looks like the include has to be absolutely in the same file as the call or it's too stupid to find it even if all the others includes are not there.
|
|
|
|
|
Shilpi Boosar wrote: Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
humm.......
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
??????????????
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
The class is called fAbout ? What a strange name. Also a strange error, from what you've said, it should work.
Is this managed C++, or MFC ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I called it fAbout because it's an about box and the f is a short for form.
and this is a managed project, but since i'm using a lot of mfc functins in it, I tought calling a form would be the same as mfc.
|
|
|
|
|
samkook wrote: f is a short for form.
Oh!! my dirty mind!
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
brahmma wrote: Oh!! my dirty mind!
mine tooo
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Are you sure,you write correct name of class
|
|
|
|
|
OK, your naming conventions are your business
There's something else going on here - did you include the file before stdafx.h ? stdafx needs to be first in the list.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
nop, I included it after the Form1.h include.
I also discovered that if I include it in stdafx, it's working. But if feel weird putting it there since About.cpp will call it twice.
|
|
|
|
|
Ok, so I'm using Visual Studio 2005 on a Windows XP computer. I have to connect to a "blackbox" through a Linksys router. The blackbox's IP address is 192.168.145.13 and the port is 5000. This blackbox is constantly outputting using the same format of:
0x01 char integer tab integer tab integer tab...integer integer
0x01 char integer tab integer tab integer tab...integer integer
0x01 char integer tab integer tab integer tab...integer integer
...
Now, I want to use Windows Forms to create the window and inside the window,
1.) I want a table to be displayed that seperates all the integers out and puts them in their own column and adds a row per output.
2.) I would also like to write the blackbox's output to a log file so I have a record of everything it said.
Basically, how would I do either of those? I have a little understanding of windows forms and such, so any explanation might have to be a little detailed. I know how to bind sources and such, but only how to bind databases made in Access, not anything else. Any help towards this would be great. I have read the tutorials and such on this website and others, but I can't get any of them to work with Windows Forms (I don't know where to put the code).
Thanks in advance!
|
|
|
|
|
No one can help with either problem? If something is confusing, let me know!
|
|
|
|
|
I have created a form with a picturebox. How do i display a bitmap file in my system into the picturebox?
|
|
|
|
|
LoadImage will load a bmp file for you, then you'll have a HBITMAP to pass to the picture box. If you want to load other formats, you'll need GDI+ or a third party library.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
lets say i want to put the codes into class CFormView
so the codes in CFormView should be
CProjectView::CFormView()
{
strPictureName = _T("C:\\Documents and Settings\\My Documents\\Blue hills.bmp");
HBITMAP hbp = (HBITMAP)::LoadImage( NULL, strPictureName, IMAGE_BITMAP, 0, 0,
LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );
m_Picture.SetBitmap(hbp);
}
am i correct? btw what is LoadImage? do i need to include a code for it?
|
|
|
|
|
Looks right - LoadImage is a windows API.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
but when i run the program, there is nothing in the picturebox..
Do i have to type anything to include LoadImage in the codes?
|
|
|
|
|
Again, no. If you couldn't see it, it wouldn't compile. If you step through, what does LoadImage return ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|