|
Yes you can. You would need to implement some sort of "packet received" reply. If the sender didn't get it in time it would resend the packet. Such protocols exist.
Steve
|
|
|
|
|
That's a lot more work than it's worth. In fact, if such code exists, it would be a lot better to buy a library than to reinvent that particular wheel. Essentially, you're trying to turn UDP into TCP/IP. There's a reason both protocols exist.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: In fact, if such code exists, it would be a lot better to buy a library than to reinvent that particular wheel.
Agreed.
Steve
|
|
|
|
|
yaminisridaran wrote: I have to use only UDP
You can do it, but by the time you implement all the checking for dropped datagrams and out-of-
sequence datagrams, you'll have rolled your own TCP
Some tips: UDP datagrams can arrive out of order or not arrive at all. That means every
datagram will need a header containing some kind of info indicating it's position or index or
whatever so you can reassemble the data on the receiving end. You need to be able to resend
datagrams that don't arrive at all and allow for packets arriving out of order. This is the
stuff TCP does for you.
Good luck!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Can u send me the sample coding for TCP Server and TCP client
S.Yamini
|
|
|
|
|
|
'nuf said already. I would suggest too, "Don't use UDP"!
Anything I will say you will bring it down to whatever you want.
|
|
|
|
|
yaminisridaran wrote: I have to use only UDP
I would be interested to hear why?
As many (Mark, etc) told there is some overhead in re-inventing TCP datastream capability with UDP, not mentioning that you can't use HTTP proxies to get out of a firewalled networks. Since you haven't stated your requirements I wonder why you want to do this.
|
|
|
|
|
Hi,
I'm a beginner in programming in C++ so there's a lot of searching and trying to do.
I've been trying to retrieve the directory that contains the project file out of VC++. I searched around and it should be possible with the namespace VCProjectEngine. There are also some examples on the net but i haven't found one yet in C++.
So for the moment I haven't been able to make a working program were i can obtain my project directory (i want to place there a cfg file with some parameters).
I've tried it with VCProject.ProjectDirectory but can't get it to work.
Can anyone help me with an example on how it works/?
Thanks in advance!
|
|
|
|
|
What's your exact problem and purpose? Why to bother with VCProjectEngine at all?
--
=====
Arman
|
|
|
|
|
I have a small application that's converting an xml file in another format. In a .config file i wanted to specify file location, where to get the xml files and where to place the output files so it's not hard coded in my application.
This .config file is placed in my application directory.
How can i find it? I have seen some sugestions and tried several things but don't succeed in it. What's your proposal?
|
|
|
|
|
Hi,
Have you tried CDocument::GetPathName () ??
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I need the header file afxwin.h for this and that's not a standard file in express edition.
I thought that namespace VCProjectEngine would be much easier!
|
|
|
|
|
Actually, you are trying to find the location of your executable. (The project file is only present on your development system.)
Look at GetModuleFileName - it will tell you the full path name of your executable file - no matter where it is run from.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
but then i need a header winbase.h/windows.h and that's not included with my Express Edition.
So i was searching for a workaround?
|
|
|
|
|
I would find that hard to believe... if you don't have windows.h and winbase.h, you can't develop windows applications - even the express edition allows that. I know the express doesn't have MFC support, but then GetModuleFileName is a Windows API call.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
I did a search on my system and the files could not be found, strange? What do i need to have those files: Platform SDK?
I haven't created an executable yet for this small application but I can debug it! I'm going to try this today and see what happens with the application that i have so far.
Thanks for your time, I'm feeling like an idiot!
Regards
|
|
|
|
|
Yes, you need the Platform SDK. Once you install that, you should be in good shape.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
hello all,
i hav a question regarding PDF creation.There is a free activex control for PDF opration which comes along with acrobat reader.I want to know whether i can use this activeX to create a pdf.If we can then pls do tell the function names to be used for creating the pdf.Or Else any one please send me an free activeX control which can be used for creation as well as viewing of pdf.Sorry if i made the query look too big.
Thanks & Regards
|
|
|
|
|
Hi,
it depends of what the destiny computer has, if they have the AdobePDF phantom printer (automatically installed with adobe writer), you don't need anything but the usual printing and selection of that printer. If you want to ensure in any case the pdf... then you should comunicate with the ActiveX or another module able to do it, and send the contents of your document. Most probably is that you will need Threads.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi gentlemen,
I am newbie to MFC programming and I have a problem creating a dialog on a separate thread from the main application.
My situation is: by clicking an icon on a toolbar, a dialog will be prompted and asking for input. As entered the numbers and clicked "OK", these parameters will be passed to the main application to run in a loop and the result will be displayed.
Without threading, the displayed result is obstructed by the dialog and applying the InValidateRect function is not satisfactory since the toolbar now becomes invisible.
Now I have create a "CSub" class based on CDialog and a "CDialogThread" class based on CWndThread. My question is, how to instruct the dialog to run on the thread, then how to pass the threaded dialog parameter back to the main application?
Thank you very much!
|
|
|
|
|
From what you explained I do not see any reason of introducing a new thread at least as far as the dialog concerns.
Without threading, the displayed result is obstructed by the dialog and applying the InValidateRect function is not satisfactory since the toolbar now becomes invisible.
This is not so clear. Why does the toolbar become invisible. What's the relationship between the dialog and InvalidateRect?
--
=====
Arman
|
|
|
|
|
Hi Arman, Thank you for your reply. The application is a MDI and the dialog is called by a function of the CView class. After the dialog passes the parameters to this function, it runs a loop which preforms a calculation and display results on the childframe window.
I tried to use InvalidateRect(NULL,NULL,true) inside the function before the loop but all the icons on the toolbar disappears and only reappears after the loop completes.
If use InvalidateRect(m_hWnd,NULL,true) then the dialog only vanish if I clicked "OK" while the dialog is upon the childframe window. If the dialog is partially away from the childframe window, then it remains appear despite I clicked "OK".
I was told that creating a separate processing thread for the dialog will solve the problem but I have little idea on multi threading with MFC.
Hope you understand and thank you very much!
|
|
|
|
|
Dear,
You need not take that much pain to accomplish this.
If all you need to inform is a count and some other simple parameters,
why dont you put them in the APP, and once you got the parameters from the dialog, AfxGetAPP(), update / set variables and then... your task is done...
regards,
haribabu
|
|
|
|
|
Hi, thank you very much. Do you mean the following?
(1)in APP.cpp
CDialog dialog
int t1 = dialog.parameter1
(2)in View.cpp
T1 = AfxgetApp()->t1
|
|
|
|