|
First of all, I'm not even sure if the topic makes sense.
I'm using native C++ compiler (Dev-C++). Anyway, I'm new to network programming and have been doing little project on network communication between two computers using WinSock (just sending and receiving string). And then I just had an idea whether this kind of "communication" will also work for FTP servers. I tried it on an ftp server on port 21. I requested connection and, to my surprise, I received a welcome message from it. But then I have no clue how to send commands/requests at all (USER or PASS). I would assume the problem is either I don't have the correct string format, or the socket type is just different (I don't have any clue about network types very much). Or maybe Winsock is just not meant for it? Please advise me on what's actually going on.
I know there are alot of free libraries out there, but I want to know what's actually happening behind it, in terms of protocols.
Thanks!
PS: Not sure if this belongs to the correct board, but move it as you wish.
Andrew
|
|
|
|
|
Very possible. You're on the right track: it's all about the protocol - what sequence of bytes
to send and receive and when to do it.
A Google search on "FTP protocol" will get you links to more than you ever wanted to know about
FTP. It's been around for a long time
I think this is the official specification: FILE TRANSFER PROTOCOL (FTP)[^]
Mark
|
|
|
|
|
Thanks, Mark! You encouraged me to find the problem why my "USER YYYY" does not produce any reply. It turns out I had the wrong CRLF closing bytes. Now at least I can do USER and PASS. =) It's getting more interesting. Thanks!
Andrew
|
|
|
|
|
Just remember Andrew that you need at least two channels, one to issue the commands and one to transfer the data.
Good luck!
/krissi
|
|
|
|
|
how can we make a normal button look like rounded rectangular button
|
|
|
|
|
|
|
Using VS2005/VC8:
I've tried the following, and all I get is a single-pane window with no client edge:
int CSplitterViewTestView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
CCreateContext context;
memset(&context, 0, sizeof(CCreateContext));
CRect cr;
GetWindowRect(&cr);
int nHeight = ::GetSystemMetrics(SM_CYSCREEN);
if (!m_splitterWnd.CreateStatic(this, 2, 1))
{
AfxMessageBox("Error setting up splitter window", MB_ICONERROR);
return FALSE;
}
context.m_pNewViewClass = RUNTIME_CLASS(CGridCtrlView);
if (!m_splitterWnd.CreateView(0, 0, RUNTIME_CLASS(CGridCtrlView), CSize(cr.Width(), nHeight), &context))
{
AfxMessageBox("(CGridCtrlView) Error setting up gridctrlview pane objects.", MB_ICONERROR);
m_splitterWnd.DestroyWindow();
return FALSE;
}
context.m_pNewViewClass = RUNTIME_CLASS(CWaitingView);
if (!m_splitterWnd.CreateView(1, 0, RUNTIME_CLASS(CWaitingView), CSize(cr.Width(), 0), &context))
{
AfxMessageBox("(CGridCtrlView) Error setting up waitingview pane objects.", MB_ICONERROR);
m_splitterWnd.DestroyWindow();
return FALSE;
}
m_splitterWnd.RecalcLayout();
return 0;
}
I get no errors at all.
-- modified at 14:37 Wednesday 13th December, 2006
[EDIT]
If I change the CreateStatic call as follows:
if (!m_splitterWnd.CreateStatic(GetParent(), 2, 1))
The following anomalies appear (yes, more than one):
1) The toolbar doesn't display
2) The status bar doesn't display until I drag the bottom border of the app over something gray.
3) I can't get a the splitter bar to react until after I resize the window once.
4) After letting go of the splitterbar, I can't move it again.
[/EDIT]
"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
|
|
|
|
|
AFAIK a CSplitterWnd can only be created in a CFrameWnd or CFrameWnd derived window. At least I have never had any luck when I tried to use it elsewhere.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Yeah, I got it to kinda work, but saying it's flakey is putting it mildly.
"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
|
|
|
|
|
Check your cr (CRect)....I don't think the WindowRect will be known in OnCreate().
Maybe try an arbitrary size in the CreateView() calls (something like CSize(100,100) just to make
sure it works.
Once you get a WM_SIZE message then you can set the panes to the real size you want.
RecalcLayout() is un-necessary here as well, I believe, for the same reason - the size is not
known yet.
|
|
|
|
|
Oh yeah....good point by PJ Arends!!
In a non-frame window you're going to have to resize the splitter window in a WM_SIZE handler,
which is extra fun with a toolbar involved Way easier to use a CFrameWnd-derived window,
in which case you can create your splitter (and toolbar, status bar, etc) in OnCreateClient().
Mark
|
|
|
|
|
I believe PJ is correct. When I want splitters inside a view I always use Paul DiLascia's CWinMgr[^].
led mike
|
|
|
|
|
After 4 years I found this thread...
I solved the problem with a MoveWindow after the call (maybe unuseful) to RecalcLayout, and I also provided the method IsFrameWnd in my container View that returns TRUE.
It seems to work
|
|
|
|
|
Post the fix then. I no longer work in C++/MFC, but I'm sure others would be interested in what you found.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "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 fix is very simple, and it seems to work
// without this method, an ASSERT fails when you click on the splitter to resize the inner windows
BOOL CMyView::IsFrameWnd() const
{
return TRUE;
}
int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
CCreateContext cc;
memset(&cc, 0, sizeof(CCreateContext));
CRect cr;
GetWindowRect(&cr);
if (!m_splitter.CreateStatic(this, 2, 1, WS_CHILD | WS_VISIBLE))
return FALSE;
cc->m_pNewViewClass = RUNTIME_CLASS(CLeftView);
if (!m_splitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(cr.Width(), 100), &cc))
return FALSE;
cc->m_pNewViewClass = RUNTIME_CLASS(CRightView);
if (!m_splitter.CreateView(1, 0, RUNTIME_CLASS(CRightView), CSize(cr.Width(), 0), &cc))
return FALSE;
// without this, it seems that the splitter created has negative size
m_splitter.MoveWindow(0, 0, cr.Width(), cr.Height());
return 0;
}
|
|
|
|
|
Hi, everybody!
I have a problem. Please, share your experience with me!
My problem:
" A faulty volume was ghosted into an image (MyIMAGE.DAT). Please, Code to find what happened and recover it (so that we can use it as ussual)."
Killer
|
|
|
|
|
Nice error message!
Isn't there a poltergeist board for this stuff?
Sorry, I have no experience to share
|
|
|
|
|
I am not going to do you homework, but I am willing to give you a few pointers.
You need to find out the following:
What is the format of the image file?
Does the image file just contain the data, or the file-system as well?
If so, which filesystem was used on the volume?
If you have the format and filesystem, you might be able to mount it using an image mounting tool, even in software.
You could then scan the files for damage (e.g. checking against CRC32 checksums in the filesystem).
That is the point at which you might actually begin to Code a tool to find and repair damaged data.
Actually, with just an image, you are missing one of the most important sources of information: SMART. You are unable to check on possible hardware defects, so my suggestion ALWAYS would be: move the (repaired) data to a new disk.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
buddy!
Thanks for your advice so much.
Nice day!
Killer.
Killer
|
|
|
|
|
hey buddy, i think its bad for you...
by the way, for you question, listen to this : NO !
|
|
|
|
|
Why you get four votes(2.0).next vote is 5
|
|
|
|
|
don't know... some certainly didn't noticed that one guy abused CP in a first time
|
|
|
|
|
I did not vote that guy a one. I marked it as spam, instead
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
brahmma wrote: I did not vote that guy a one. I marked it as spam, instead
it isn't spam, it is abuse...
|
|
|
|
|