|
Jim Crafton wrote: ...I don't think I can (or want to) create a console window can I?
Sorry, I read your "command line process" comment to mean a window was present.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am curious about a situation I have run into. I am hacking a program that was originally meant to read/write serially (serial port) into using UDP. I'm trying to preserve as much of the original code as possible for reasons that I won't bother you with here.
The situation is that a ReadCom() function is called with a specific number of bytes that the calling function wants. For example, when the buffer to be read from has 22 bytes in it, the ReadCom() may be called asking for only 16 bytes. Another ReadCom() will be called later asking for the remainder.
When I replace the serial port reads with a recvfrom(), it looks like the entire UDP message is gone after the first read even though I only asked for a partial number of bytes.
I have two people here telling me different things. One says this should not happen - it is a FIFO, another saying that any time a recvfrom call is made, the entire UDP packet is cleared.
Which is it? The behaviour seems to match with it being cleared but I would like to know what you think.
BTW - I have tried using the ioctl with FNIOREAD to see how many bytes are available and it does say that 0 are available on the second read.
|
|
|
|
|
The second person is right on - when dealing with UDP you will get the data you ask for and any remaining data in the datagram/message/packet is lost. That is the way things work with a "unreliable protocol" like UDP.
I would suggest using a larger buffer, copying all available data to that buffer, and you can then look at that buffer for additional data if required.
Note that if the data is serial, you likely want to get it in order. If you send multiple UDP packets, they may arrive out-of-order, or some may not arrive at all. You will want to use TCP sockets if that is going to be a problem.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thank you very much. I'm working on keeping my own copy of the data now.
I appreciate the help.
|
|
|
|
|
To add to James' excellent reply....this is from the docs:
"If the datagram or message is larger than the buffer specified, the buffer is filled with the
first part of the datagram, and recv generates the error WSAEMSGSIZE. For unreliable protocols
(for example, UDP) the excess data is lost;"
Better to recv the exact datagram size or more to make sure you get the etire datagram
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Mark Salsbery wrote: To add to James' excellent reply
'Danka!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James R. Twine wrote: 'Danka!
de nada
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
hOw can i cOde this Output in C using fOr lOops..
ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
|
|
|
|
|
dO yOu have any trOuble with yOur 'O' key ???
for your problem, first give us what you already tried, and ask a specific question then about why you're stuck. we here do not do homework
|
|
|
|
|
He has got tic, if he wants to write the letter 'o' his left or right hand always "runs" to press the shift button. It's unstopable :]
|
|
|
|
|
nO its just ma style Ov typing...:p
|
|
|
|
|
bushxee wrote: nO its just ma style Ov typing...:p
but you're not alone, and this is is far from being a "H4x0r" site. so please comply, speak english, and type well (and no need to ask to explain your problem correctly and fully...)
|
|
|
|
|
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int a,b=72,in,out,d=71;
for(a=9;a>=1;a--)
{
for(int j=65;j<=b;j++)
{
printf("%c",j);
}
b--;
for(int i=d;i>=65;i--)
{
printf("%c",i);
}
printf(" ");
d--;
printf("\n");
}
getch();
}
dis iz ma code...
|
|
|
|
|
1) read the Posting guidelines[^]
2) do no type in SMS but in plain english
3) tell what's wrong then...
|
|
|
|
|
toxcct wrote: do no type in SMS but in plain english
i need the guide to SMS english
"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
|
|
|
|
|
ThatsAlok wrote: i need the guide to SMS english
please noooo (or ask the mobile development forum )
|
|
|
|
|
I think it doesnt have error it needs to your work;) and when you want to show a code use of pre
|
|
|
|
|
bushxee wrote: dis iz ma code...
what do you want to do?
"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
|
|
|
|
|
bushxee wrote: printf("%c",j);
And yet another new developer starts learning bad habits... In this case, using a heavyweight solution (printf(...) ) when a lighter, faster one is available (putchar(...) ).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
bushxee wrote: dis iz ma code...
diz iz ma soltn: uz da debugga
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
toxcct wrote: dO yOu have any trOuble with yOur 'O' key ???
thats Big OOOOH notation
"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
|
|
|
|
|
Hi all
I have developed an application and now I want to change the background of each and every dialog box and also of the non client area of the main frame window. I want to change it to the color with gradient effect.
How can I do that?
Thanks
Sameer Thakur
|
|
|
|
|
|
Thanks for reply.
Yes I have already tried it. It changes the background color. It also adds the gradient effect but only to the dialog boxes.
My requirement is to provide gradient effect to each dialog box, non client area, various controls like button, edit box, progress bars, list box, list controls, caption bars….. in short to every single control or window visible to the user.
How can I achieve this?
Thanks
Sameer Thakur
|
|
|
|
|
what have you tried then ?
|
|
|
|