|
Hiii
I wanna know the term "IP Stack". What does it contain? What is the purpose of it? Where it resides inside Operating system?
Thanking you
Krish
|
|
|
|
|
If you want to know basics then this[^] is always the best place to start.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Is 'your' Google broken, today?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
bleedingfingers wrote: Let me google that.
Let me google bing that.
FTFY.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
No, google is actually a verb found in the dictionary which means to search the web, yeah...eat it M$ fanboy...
|
|
|
|
|
Hi i have to read a binary file from disk and i have to transfer file through serial port. i am using mscomm1 in vc++ 6.0.
Please help how to transfer a binary file through serial port.
|
|
|
|
|
What is your doubt about?
Read the file in binary mode and then send the data on the serial line (set the Output property).
BTW Why are you using MsComm (instead of Win32 API )?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i am working on dialog based application , i need to transfer binary file. any examples or sample code which helps me.
|
|
|
|
|
Still you're not giving info about your doubts. Are you able to read a binary file? Do you know how to use MsComm or Win32 API for serial communication?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
here i will give the example what i am doing.
CFile file;
CString str;
unsigned char ch;
if(file.Open("source.bin",CFile::modeRead|CFile::typeBinary))
int nLength = file.GetLength();
for(i=0;i<=nLength;i++) //Transfering file data
{
file.Read(&ch,1);
str.Format ("%c",ch);
m_mscom.SetOutput (COleVariant(str));
}
is it the right way to transfer a binary file ?. i have to transfer a binary file up to 15MB.
|
|
|
|
|
Well, you don't need to read the file (and write it to the serial port) a character at time (incidentally your loop-exit condition it's wrong, you should use i<nLength ).
For sending binary data, you need to fill a SafeArray and pack it into a Variant , see, for instance: "Mscomm and mode binary" at codeguru (using MFC OLE wrapper classes really helps here).
Again, you may also choose to avoid COM and go with Win32 's CreateFile, WriteFile , .., see the link Paniello provided.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
BYTE *pBuffer = new BYTE[nLength];
COleVariant var;
CByteArray barr;
file.Read(pBuffer,nLength);
for(UINT i = 0; i <sizeof((pBuffer)/sizeof(BYTE)) ; i++)
{
barr.Add(bytes[i]);
}
var=barr;
m_mscom.SetOutput(var);
is it right way ,if file size is 5000 byte it will work?.because i have to transfer up to 15MB .
|
|
|
|
|
Why don't you try (start with small amount of data)?
You know, sending 15MB of data will take more than 20 minutes even at 115200 baud.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ok i will try with small file.
|
|
|
|
|
|
jiya-123 wrote: for(UINT i = 0; i < sizeof((pBuffer)/sizeof(BYTE)) ; i++)
Really? You do realize that loop equates to:
for(UINT i = 0; i < 4; i++)
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Please refer to: http://msdn.microsoft.com/en-us/library/aa363196(v=VS.85).aspx[^]
Regards.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
for binary data, you have to make sure the driver doesn't interfere with the data at all; so you must check each and every port setting, including:
- pass NULL;
- don't change CR/LF;
- don't enable software handshaking.
FWIW: I tend to avoid binary communication over serial ports; when portability is more important than performance, I'd rather do some encoding, typically stuffing 2 bytes in 3 printable characters (i.e. the range 0x20-0x7E), so port settings wouldn't interfere with it at all.
|
|
|
|
|
hi Luc Pattyn do you have a sample code , so it will help to understood, still i am confuse
|
|
|
|
|
No, as I said I avoid doing such things as it is more trouble than its worth most of the time. I haven't done any binary serial comm on Windows using C/C++ in many years; and if I really had to do it today, I'd use C# anyway.
|
|
|
|
|
Just create a file pointer to the serial port com1/com2.
And do operations read file and write file with small chunks of data.
And about the UI(User interface ) that u can create using MFC dialog based application.
Silly matter only...
Thanking you
Krish
|
|
|
|
|
Chances are the eunuch guarding the serail port won't like binary data.
|
|
|
|
|
Generally, there's no problem sending binary data through a serial port if you are sure both ends are using full transparancy of the data, allow NULLs, CR/LF expansion (as mentioned by someone else above). XOFF and XON and EOF also need to be transparent.
The real issue is what do you do about "transmission errors"? There's no guarantee that serial data gets to the other side without problems, dropped bits, character framing errors. So, typically you have to wrap the data with some higher level checking, CRC, etc to ensure proper transmission of the data. Of course, since corruption is detected on the receiving side, you then need to tell the transmitter to re-send the data stream. Wait, this is beginning to sound a lot like a complete protocol.....
|
|
|
|
|
I've been there. And it might be easier/better to install SLIP and use FTP then. Unfortunately the OP never mentioned what the other side was, in fact he didn't give any context.
BTW: The transparency reply was mine also, this one was a reaction on the typo in the subject line.
|
|
|
|