|
hotari wrote: The writer is in Budapest and I have a language barrier. That and he's done zip in over 2 yrs to resolve these issues
Well that is most unfortunate! It sounds like it needs some serious debugging...some pointer "issues" I suppose
Mark
|
|
|
|
|
Can you recomend a few steps , I as a newbie could take to move this situation forward in debugging?
Very appreciative ,
robert.
|
|
|
|
|
If you have access to the source code you can build a debug version and run it in the debugger.
Then when it crashes you'll at least see what line of code is causing it. Then it's a matter
of "Is it just that line or a result of something(s) executed before that line?" To do this
requires knowledge of the language it's written in, knowledge of the platform (Windows, DOS, Unix,
etc.) it's running on, etc. This is the a job of the programmer Memory
faults like this are unacceptable IMO (I was joking about the 50% rule haha) for (at least) one
obvious reason - the program stops running.
Mark
|
|
|
|
|
Ok . Thank you. I'd be happy if the errors would at least be invisible as the app still runs provided the first error window isn't closed. Not sure if thats even realistic though. Believe me, it started at only 50% a few years ago
|
|
|
|
|
Do you have soruce code and if yes did you use of debugger?
|
|
|
|
|
After speaking with the writer , in half english , broken Hungarian on my part , I suspect , and no I don't have source , The debugger app may pose a language issue. Are debuggers English heavy in their operation ?
Here's the writers response to the error codes I found:
I can not to fix it.
It is a windows memory problem.
Our computer memory is 1 GB, and sometimes happend this error message.
I do not know why, I have not idea how can I fix it.
Sorry.
-- modified at 18:23 Friday 20th October, 2006
|
|
|
|
|
Hi there,
I am using TCP/IP socket to connect two aplications to each other that exchange too many messages (sending, receiving, and Acking on them) sometimes there are many messages in one TCP packet going through the socket and as a result, when one application receives too many messages appended to each other in one receiving packet, it can not handle the messages properly. Is there any way to prevent this problem (having too many messages in one TCP packet). when the trafic is not very busy, there is just one message per packt going through the socket at a time but as I mentioned, sometimes there are many messages appended to each other in one packet that receives at once.
I apreciate any help.
Best regards,
|
|
|
|
|
TCP/IP is stream oriented, not packet. If you want packets it's up to you to break the stream
into packets. If you send a "packet" on a TCP/IP socket there's no guarantee you will get a
full "packet" in one recv at the other end. You need to poll or wait for FD_READ notifications
on the receiving end until you receive all the bytes making up an entire "packet", handle the
message, and repeat.
How are you handling reading and writing the socket? Separate thread? FD_READ notifications
through an HWND? Have you messed with the send/receive buffer sizes or any other socket settings?
Post an example I'll try to help
Mark
|
|
|
|
|
Here is one example of my XML string comming in one single receiving data: as you can see each time I receive one Message, it should start with time and then the start of string which is WEResp or WESend or Recv and after that the whole string should come by ending string that would be . when the trafic is not very busy I receive the string like that but sometimes I receive many strings appended to each other and as you mentioned, some times it goes beyond my buffer size in which I would lose information. What my code does is that using a thread, reads the info and put it in a buffer and then parse it and sends it down to another application.
Oct 07 11:03:53.359 i: : <weresp id="128"><deviceid>210<groupid>1<msgtype>5<flags>144<status>S<responsecode>2
<wesend id="115"><deviceid>87<groupid>1<priority>0<msgtype>3<flags>128<datalen>50000030805<status>N<wesend id="130"><deviceid>232<groupid>1<priority>1<msgtype>5<flags>128<datalen>3000200<status>N<wesend id="131"><deviceid>232<groupid>1<priority>1<msgtype>5<flags>128<datalen>3000200<status>N<wesend id="132"><deviceid>41<groupid>1<priority>0<msgtype>3<flags>128<datalen>50000030804<status>N<wesend id="149"><deviceid>167<groupid>1<priority>0<msgtype>3<flags>128<datalen>1000000106030000660101<status>N<wesend id="58"><deviceid>
Oct 07 11:03:53.468 o: : 181<groupid>1<priority>0<msgtype>1<flags>128<datalen>150001480C0301010000060106010B05<status>N<wesend id="63"><deviceid>181<groupid>1<priority>0<msgtype>32<flags>128<datalen>21308<status>N<wesend id="66"><deviceid>181<groupid>1<priority>0<msgtype>5<flags>128<datalen>1100001083130382C2048414E53454E204E4F5254482072642C2042524D50544E0D0A0D0A444553542E2E2E0D0A4252414D414C45412042415054495354204348555243480D0A393035302C2044495849452072642C202320432C2042524D50544E0D0A0D0A5452583D303432333436<status>N<wesend id="72"><deviceid>87<groupid>1<priority>0<msgtype>3<flags>128<datalen>50000030805<status>N<wesend id="74"><deviceid>232<groupid>1<priority>0
thanks for the help.
|
|
|
|
|
The easiest thing to do is tack a header structure (fixed-length) on to each packet you send.
I'll call it MYPACKETHEADER.
On the receive end read sizeof(MYPACKETHEADER) bytes. In that header structure should be a
datalength variable (an int, DWORD, WORD, whatever is appropriate). When you've received
an entire header, read the datalength and now you know how many bytes to read to get the entire
packet.
The way you are doing it now you need to read smaller chunks and parse as you go. Just reading
until there's no more to receive is not good idea (buffer overflow as you mentioned)
Can you post an example of the code you are using to receive from the socket?
Mark
|
|
|
|
|
As mentioned previously TCP provides a stream and you must never rely on data received to be in the same "chunks" as you send them away, you may get multiple chunks at once or possibly only the first bytes of a chunk. In brief this means: collect data coming in and split it up, for example use a text delimiter like a newline between each of your XML strings.
Hope it helps.
/M
|
|
|
|
|
anyone can help me to explain this process step- by- step?
struct list_ele *<br />
sortfun( struct list_ele *list )<br />
{<br />
<br />
int exchange;<br />
struct list_ele *nextp, *thisp, dummy;<br />
<br />
dummy.pointer = list;<br />
do{<br />
exchange = 0;<br />
thisp = &dummy;<br />
while( (nextp = thisp->pointer)<br />
&& nextp->pointer){<br />
if(nextp->data < nextp->pointer->data){<br />
<br />
exchange = 1;<br />
thisp->pointer = nextp->pointer;<br />
nextp->pointer =<br />
thisp->pointer->pointer;<br />
thisp->pointer->pointer = nextp;<br />
}<br />
thisp = thisp->pointer;<br />
}<br />
}while(exchange);<br />
<br />
return(dummy.pointer);<br />
}<br />
~~~@@@###EZRA###@@@~~~
|
|
|
|
|
It's ordering a linked list.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It is ordering a linked-list using a bubble sort.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Q1
We want to store the information about a student. This information includes student’s name, address and roll number. What data type (either built in or user defined) should be used to store all this information in a single variable.
Also we want to store the marks obtained of a student. The marks can be of type integer, character or float. We have to store the student’s marks in a variable of a particular data type. What data type (either built in or user defined) should be used to handle such a wide range of values.
Q2
As we know that in a windows application whenever a key is pressed, a message is sent to the active window. We are developing a DOS based application and want to detect whenever a key is pressed from keyboard. How can we do so?
Q3
We are writing a DOS based application in which we have to display the system date and time. Write down the code for doing so.
Shehwar
|
|
|
|
|
Double posting homework questions isn't likely to get you any answers.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
A3
int main(int argc, char* argv[]){
char dateStr [9];
char timeStr [9];
_strdate_s( dateStr,9);
_strtime_s( timeStr,9);
//do what you want with variables;
printf("Time is %s date is %s",timeStr,dateStr);
system("pause");
return 0;
}
Cannot advise in other questions..
Sorry!
|
|
|
|
|
Sorry - didn`t read your post carefly - my answer won`t help you...
|
|
|
|
|
Q1 - why did you post this twice ?
Q2 - If someone does this for you, how do you hope to be able to do your next piece of homework ?
Q3 - These questions are really easy, did you sleep in class, lose your text and forget to use google, or would you just be better off doing a different course ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I recommend you make your homework yourself.
|
|
|
|
|
1) We are writing a DOS based application in which we have to display the system date and time. Write down the code for doing so.
2) As we know that in a windows application whenever a key is pressed, a message is sent to the active window. We are developing a DOS based application and want to detect whenever a key is pressed from keyboard. How can we do so?
3)We want to store the information about a student. This information includes student’s name, address and roll number. What data type (either built in or user defined) should be used to store all this information in a single variable.
Also we want to store the marks obtained of a student. The marks can be of type integer, character or float. We have to store the student’s marks in a variable of a particular data type. What data type (either built in or user defined) should be used to handle such a wide range of values.
Dure-shehwar
|
|
|
|
|
Dure-Shehwar wrote: 1) We are writing a DOS based application in which we have to display the system date and time. Write down the code for doing so.
Use the time-related APIs.
Dure-Shehwar wrote: 2) As we know that in a windows application whenever a key is pressed, a message is sent to the active window. We are developing a DOS based application and want to detect whenever a key is pressed from keyboard. How can we do so?
One such way is with getchar() .
Good luck with your homework. Next time, either go to class or don't sleep when you do go. Read #9 here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Good luck with your homework
Nice
|
|
|
|
|
(1)GetSystemTime();
----------------
(2)David Crow answer
---------------
(3)Single variable?
|
|
|
|
|
WhiteSky wrote: GetSystemTime();
In DOS? Are you smoking the good stuff today?
led mike
|
|
|
|