Click here to Skip to main content
15,915,742 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: base class operations don't call derived class operations [modified] Pin
boogalo7929-May-06 5:01
boogalo7929-May-06 5:01 
GeneralRe: base class operations don't call derived class operations [modified] Pin
toxcct29-May-06 5:04
toxcct29-May-06 5:04 
AnswerRe: base class operations don't call derived class operations Pin
Niklas L29-May-06 5:13
Niklas L29-May-06 5:13 
GeneralRe: base class operations don't call derived class operations Pin
boogalo7929-May-06 5:31
boogalo7929-May-06 5:31 
GeneralRe: base class operations don't call derived class operations Pin
G Haranadh29-May-06 7:46
G Haranadh29-May-06 7:46 
AnswerRe: base class operations don't call derived class operations [modified] Pin
Stephen Hewitt29-May-06 13:52
Stephen Hewitt29-May-06 13:52 
GeneralRe: base class operations don't call derived class operations [modified] Pin
Member 303984329-May-06 23:07
Member 303984329-May-06 23:07 
QuestionProblem Reciving data in ftp using winsock [modified] Pin
darkcloud.42o29-May-06 3:38
darkcloud.42o29-May-06 3:38 
Hi,
Im pretty new to C++.. been messing with the standard library for a while..
but im in need of some help here.. i apologise i dont really have decent code
to show.. as i said im new... Anyway.. the problem is im getting some strange imput from the command line console some after the accepting socket...
heres what i get...

C:\>winsock
Listening on Socket
USER test
q▲∟¼q↔¼q^↔¼qzv½qPëV
PASS test
qi ¼q2è½q►=½q╡↔¼qµ@½qUSER test
q▲∟¼q↔¼q^↔¼qzv½qPëV
Listening on Socket

Yeah.. my computer beeps and everything.. some strange mating call of FTP i presume... basically i was wondering what that is.. and how to recieve data in only regular text format after sending data... so i can process the login and other ftp commands...

heres what i get in the client so far for this code...

[R] Connecting to 127.0.0.1 -> IP=127.0.0.1 PORT=21
[R] Connected to 127.0.0.1
[R] 220 Welcome to my Custom FTP
[R] USER test
[R] 331 Password Required
[R] PASS (hidden)
[R] 230 Welcome to my Custom FTP.
[R] SYST
[R] QUIT

please have a look at the code... im using devc++ and it does compile ok...
without further wait.. heres what ive got so far...

#include <winsock2.h>
#include <string.h>
#include <iostream.h>
using namespace std;
int accept(SOCKET AcceptSocket, SOCKET ListenSocket);

int main() {
int sk;
WSAData wsaData;
WORD wVersionRequested;
wVersionRequested=MAKEWORD(2, 0);
WSAStartup( wVersionRequested, &wsaData );

sockaddr_in service;
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr("127.0.0.1");
service.sin_port = htons(21);

int test;
while(1){
SOCKET ListenSocket;
ListenSocket = socket(AF_INET, SOCK_STREAM, 0);
if (bind( ListenSocket,
(SOCKADDR*) &service,
sizeof(service)) == SOCKET_ERROR) {
cout << "bind() failed.\n";
closesocket(ListenSocket);
return 1;
}
cout << "Listening on Socket\n";
SOCKET AcceptSocket;
sk=listen( ListenSocket, 10 );
AcceptSocket = accept( ListenSocket, NULL, NULL );
test=accept(AcceptSocket, ListenSocket);
#ifdef WIN32
Sleep( 5000 );
#endif
if(test==2){break;}
}
WSACleanup(); return 0;

}

int accept (SOCKET AcceptSocket, SOCKET ListenSocket) {

int bytesSent;
int bytesRecv;
int test;
char sendbuf[1024] = "220 Welcome to my Custom FTP\n";
char* recvbuf = "";
char user[32];
char pass[32];
bytesSent=send( AcceptSocket, sendbuf, strlen(sendbuf), 0 );
while(1) { bytesRecv=recv( AcceptSocket, user, strlen(user), 0 ); break;}
#ifdef WIN32
Sleep( 50 );
#endif
char newsendbuf[1024]="331 Password Required\n";
bytesSent=send( AcceptSocket, newsendbuf, strlen(newsendbuf), 0 );
while(1) { bytesRecv=recv( AcceptSocket, pass, strlen(pass), 0 ); break;}


//HERE IS WHERE I COUT USER AND PASS and wierd result
cout << user << "\n" << pass << "\n";

Sleep( 50 );
char newendbuf[1024]="230 Welcome to my Custom FTP.\n";
bytesSent=send( AcceptSocket, newendbuf, strlen(newendbuf), 0 );
Sleep( 50 );
closesocket(ListenSocket);
}


// ANY HELP IS APPRECIATED THNX IN ADVANCE Wink | ;)

-- modified at 10:26 Monday 29th May, 2006
QuestionInheritance issue [modified] Pin
big_denny_20029-May-06 3:22
big_denny_20029-May-06 3:22 
AnswerRe: Inheritance issue [modified] Pin
toxcct29-May-06 3:26
toxcct29-May-06 3:26 
GeneralRe: Inheritance issue [modified] Pin
big_denny_20029-May-06 3:30
big_denny_20029-May-06 3:30 
GeneralRe: Inheritance issue [modified] Pin
toxcct29-May-06 3:36
toxcct29-May-06 3:36 
GeneralRe: Inheritance issue Pin
Cedric Moonen29-May-06 3:43
Cedric Moonen29-May-06 3:43 
GeneralRe: Inheritance issue Pin
Sarath C29-May-06 3:46
Sarath C29-May-06 3:46 
GeneralRe: Inheritance issue Pin
Sarath C29-May-06 3:45
Sarath C29-May-06 3:45 
AnswerRe: Inheritance issue Pin
Sarath C29-May-06 3:38
Sarath C29-May-06 3:38 
GeneralRe: Inheritance issue Pin
Stephen Hewitt29-May-06 14:32
Stephen Hewitt29-May-06 14:32 
AnswerRe: Inheritance issue [modified] Pin
Stephen Hewitt29-May-06 14:37
Stephen Hewitt29-May-06 14:37 
QuestionContext Menu - Adding an Item in the Windows explorer context menu Pin
Tamal Saha29-May-06 3:11
Tamal Saha29-May-06 3:11 
AnswerRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
toxcct29-May-06 3:16
toxcct29-May-06 3:16 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
Owner drawn29-May-06 17:37
Owner drawn29-May-06 17:37 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
toxcct29-May-06 21:22
toxcct29-May-06 21:22 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
Owner drawn30-May-06 21:12
Owner drawn30-May-06 21:12 
GeneralRe: Context Menu - Adding an Item in the Windows explorer context menu Pin
toxcct30-May-06 21:39
toxcct30-May-06 21:39 
QuestionC++/CLI Pin
Sarath C29-May-06 3:10
Sarath C29-May-06 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.