|
Somebody please tell me how to implement SLIP? I have no much idea about it. I dont know how i must start with it. It would be of great help if someone can help me as to how to start..
|
|
|
|
|
Take a look at the RFC (http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc1055.html)
PROTOCOL
The SLIP protocol defines two special characters: END and ESC. END is
octal 300 (decimal 192) and ESC is octal 333 (decimal 219) not to be
confused with the ASCII ESCape character; for the purposes of this
discussion, ESC will indicate the SLIP ESC character. To send a
packet, a SLIP host simply starts sending the data in the packet. If
a data byte is the same code as END character, a two byte sequence of
ESC and octal 334 (decimal 220) is sent instead. If it the same as
an ESC character, an two byte sequence of ESC and octal 335 (decimal
221) is sent instead. When the last byte in the packet has been
sent, an END character is then transmitted.
Are you implementing this on Windows ?
I would recommend creating layers ( translated as C++ Classes )
Transport Layer
Slip Layer
You will have to have two threads that do the job of sending and receiving data . In other words the job of the SLIP layer is to send packets by adding SLIP characters and the reverse ( receive packets and then sense the SLIP characters , then strip out these characters and notify the top layer that data has come )
I would suggest implementing callbacks so that the layers above can be notified upon data reception / successful sending of data / error conditions
Additionally you can add CRC checking in the transport layer
The transport layer can contain additionals such as retries , retry counts etc
As for the low level IO , use the standard serial port API's such as PurgeCOmm and readfile and writefile
Engineering is the effort !
|
|
|
|
|
Hello all
I am using SQL server 2000
and in the MFC program I am using CDatabase to do the database operation. Due to multithread environment some times the application give some Transaction Deadlock messages.
I am not able to get much information which transaction occur the deadlock. CDBException is also of not much use.
Is there any API or method that can give me more useful message regaridn the dedalock orrurance and the which transaction occurs the dead lock.
Regards
Anil
|
|
|
|
|
Heya,
I'm trying to find some source code online to address the above mentioned. Can't seem to find anything, however. I am actually developing this program in my spare time and would like some reference code. The program is supposed to be able to execute in the fashion "At +00:00:00 ls -l" for example, or "At @00:00:00 ls -l" and check that the time / commands given are valid, etc. If anyone knows of anything, please let me know.
Thanks always,
TM
T.M.
|
|
|
|
|
Depending on what version you have, Windows already has an AT command.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Well, I am creating it in unix.
T.M.
|
|
|
|
|
Dest2KO wrote: Well, I am creating it in unix.
But you asked in a Windows forum.
Doesn't Unix already have such a command?
http://bama.ua.edu/cgi-bin/man-cgi?00+00[^]
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Well sure.
But I am creating my own. It would help if I knew the source code of at(), though.
T.M.
|
|
|
|
|
thanks for one and all..
nice suggestion..
thanks again..
regards
|
|
|
|
|
according to the docs on MSDN, WM_SIZE is sent after a window has been sized, and WM_SIZING is sent while a window is being sized. In reality, this doesn't seem to be the case. While the edge of the window is being dragged, a WM_SIZE message is continuously being sent. Is there a way to overide this feature and have the message sent only after the mouse has been released? My WM_PAINT handler has a lot of work to do, a little too much to do before the next message is sent, causing things not to be painted in their correct positions. My solution to this is to draw a bounding rectangle for the window while the edges are being dragged and only repaint the window once the mouse has been released.
|
|
|
|
|
why dont u maintain a state variable that indicates if the mouse is being dragged and ignore the message in ur OnPaint handler
Engineering is the effort !
|
|
|
|
|
You are dealing with a windows setting. On XP: Control Panel->Diplay->Appearance->Effects->Show window contents while dragging. Clear that checkbox and WM_SIZING and WM_SIZE will work as MSDN says.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
I never realised that before. Unfortunatly if I change that setting, it will be changed for all windows, not only mine, therefore I think it best not to use. Thanks anyway.
|
|
|
|
|
The documentation, and what you are observing, are entirely correct.
Use the WM_ENTERSIZEMOVING / WM_EXITSIZEMOVING messages if you want to know when the user has started/stopped sizing your window.
|
|
|
|
|
Thanks for that. Using those messages I have managed to create a smoother resizing effect without having to use a bouding rectangle like I initialy thought.
Now all I need to do is work out why the window region is causing so much flicker.
|
|
|
|
|
>>Now all I need to do is work out why the window region is causing so much flicker.
Take a look at WM_ERASEBKGND.
By default every repaint of the window, the background gets drawn, then the foreground (via your
WM_PAINT handler).
If you handle WM_ERASEBKGND (even by just returning true indicating you have handled drawing the
background) you can handle drawing the background yourself. This makes for much smoother,
flicker-free painting
Mark
|
|
|
|
|
In addition to what Mark said, if you make use of the clip box (CDC::GetClipBox) you can limit your drawing to just the areas of the window that need repainting instead of repainting the entire window every time.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello,
anybody knows how to activate all views in MDI without going thru
CDocManager dialog?
I have tryed GetFirst... GetNext.. but it only works on views which are already active.
Ideally I like to have all templates views tilled on opening the application.
Thanks for reading.
|
|
|
|
|
POSITION pos = MyApp.GetFirstDocTemplatePosition();
while (NULL != pos)
{
CDocTemplate *pTemplate = MyApp.GetNextDocTemplate(pos);
pTemplate->OpenDocumentFile(NULL);
}
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
|
i have a 1000*1024 8bit UINT8 array
how can i save it as a bmp or tiff file??
the size of the picture is fixed, as simple as possible, just an array with fixed size and bitsize.
and need to be saved as fast as possible
thanks alot!
|
|
|
|
|
For BMP...
Initialize and write
1) a BITMAPFILEHEADER structure
2) a BITMAPINFO or BITMAPCOREINFO structure
3) the image bytes from your array
For TIFF (and BMP and others) you could use GDI+
1) Create a GDI+ Image object from your image data bytes
2) Use Image::Save() to save in a variety of formats
Mark
|
|
|
|
|
Assuming the bytes are in the right order, use CreateFile() to create/open the file, and use WriteFile() to write to the file.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all my friendz,
i'm developing an application to check multiple mail accounts. I use Iwebbrowser2...and so IE to browse mails.
Now I'm considering a problem. Suppose a person who uses my tool has an instance of IE open...and suppose he has just controlled his mail(without logging out)...my tool starts its check but goes directly inside the account(does not find login page)...and so the tool does'nt find the page it expect to find and fails.
Even if i delete the cookie associated to that account before running the check, if another IE browser instance is open the information remains! (i think in index.dat).
So there is some way to go in any case at login page, without considering the informations in index.dat or cookies???...
please help (
|
|
|
|
|
I am opening a file in readwrite and shareexclusive mode, but later want to change this to different access and share modes, but can't figure out how to do it. I tried using SetStatus but it doesn't seem to work (I think I don't know how to set the m_attributes correctly)... I am currently closing the file and reopening it, which feels like a cludge to me! Any suggestions?
First time opening file:
CFile writeFile;
writeFile.Open(curFile, CFile::modeCreate | CFile::modeReadWrite | CFile::shareExclusive, &fileException)
Then I close and reopen:
writeFile.Close();
writeFile.Open(curFile, CFile::modeRead | CFile::shareDenyWrite, &fileException);
The SetStatus code that is NOT working is:
CFileStatus status;
writeFile.GetStatus( status );
status.m_attribute = status.m_attribute | writeFile.readOnly;
writeFile.SetStatus( curFile, status );
Thanks in advance!
|
|
|
|