Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RegisterClass Pin
Nishad S11-Oct-06 1:50
Nishad S11-Oct-06 1:50 
GeneralRe: RegisterClass Pin
Steen Krogsgaard11-Oct-06 1:57
Steen Krogsgaard11-Oct-06 1:57 
AnswerRe: RegisterClass Pin
Hamid_RT11-Oct-06 1:40
Hamid_RT11-Oct-06 1:40 
GeneralRe: RegisterClass Pin
Nishad S11-Oct-06 18:09
Nishad S11-Oct-06 18:09 
AnswerRe: RegisterClass Pin
David Crow11-Oct-06 7:39
David Crow11-Oct-06 7:39 
GeneralRe: RegisterClass Pin
Nishad S11-Oct-06 18:07
Nishad S11-Oct-06 18:07 
Questionwhats wrong with my program. [modified] Pin
dorbeck10-Oct-06 23:50
dorbeck10-Oct-06 23:50 
AnswerRe: whats wrong with my program. Pin
Cedric Moonen10-Oct-06 23:59
Cedric Moonen10-Oct-06 23:59 
//TCP/IP code

mySocket = socket(PF_INET, SOCK_STREAM, 0);
struct sockaddr_in  itsTCPAddr;
memset (&itsTCPAddr, 0, sizeof(itsTCPAddr));
itsTCPAddr.sin_family = AF_INET;

uint32 IPbytes;

// try if hostname is hard ip address
if ((IPbytes = inet_addr(itsHost.c_str())) == INADDR_NONE) {
struct hostent*       hostEnt;        // server host entry

// No, try to resolve the name
if (!(hostEnt = gethostbyname(itsHost.c_str()))) {
    LOG_ERROR(formatString("Socket:Hostname (%s) can not be resolved",
                                                       itsHost.c_str()));
    return (itsErrno = BADHOST);
}

// Check type
    if (hostEnt->h_addrtype != AF_INET) {
     LOG_ERROR(formatString("Socket:Hostname(%s) is not of type AF_INET",  itsHost.c_str()));
           return (itsErrno = BADADDRTYPE);
     }
     memcpy (&IPbytes, hostEnt->h_addr, sizeof (IPbytes));
   }
  memcpy ((char*) &itsTCPAddr.sin_addr.s_addr, (char*) &IPbytes, sizeof(IPbytes));
}
itsTCPAddr.sin_addr.s_addr = htonl(INADDR_ANY);

connect(mySocket, mySockAddr, sizeof(struct sockaddr_in));
}


What is doing this code outside any functions (and out of the main function) ? You cannot have code outside functions (otherwise how will you call this code ?), only variable declarations.

Furthermore, the first error ( error C2660: 'send' : function does not take 2 ) is because you don't respect the function prototype (check the doc to see how to use the function).


Cédric Moonen
Software developer

Charting control [Updated - v1.1]

GeneralRe: whats wrong with my program. Pin
dorbeck11-Oct-06 2:15
dorbeck11-Oct-06 2:15 
GeneralRe: whats wrong with my program. Pin
Cedric Moonen11-Oct-06 2:30
Cedric Moonen11-Oct-06 2:30 
GeneralRe: whats wrong with my program. Pin
dorbeck11-Oct-06 2:44
dorbeck11-Oct-06 2:44 
GeneralRe: whats wrong with my program. Pin
Cedric Moonen11-Oct-06 3:02
Cedric Moonen11-Oct-06 3:02 
GeneralRe: whats wrong with my program. Pin
dorbeck11-Oct-06 21:26
dorbeck11-Oct-06 21:26 
GeneralRe: whats wrong with my program. Pin
Cedric Moonen11-Oct-06 21:44
Cedric Moonen11-Oct-06 21:44 
GeneralRe: whats wrong with my program. Pin
dorbeck11-Oct-06 21:56
dorbeck11-Oct-06 21:56 
GeneralRe: whats wrong with my program. Pin
Cedric Moonen11-Oct-06 22:41
Cedric Moonen11-Oct-06 22:41 
GeneralRe: whats wrong with my program. Pin
dorbeck11-Oct-06 23:00
dorbeck11-Oct-06 23:00 
GeneralRe: whats wrong with my program. Pin
David Crow11-Oct-06 7:42
David Crow11-Oct-06 7:42 
JokeRe: whats wrong with my program. Pin
Rajesh R Subramanian11-Oct-06 0:02
professionalRajesh R Subramanian11-Oct-06 0:02 
GeneralRe: whats wrong with my program. Pin
Mark Salsbery11-Oct-06 6:55
Mark Salsbery11-Oct-06 6:55 
Questionwhat is a strongly typed and loosely typed language ? Pin
CodeVarma10-Oct-06 23:36
CodeVarma10-Oct-06 23:36 
AnswerRe: what is a strongly typed and loosely typed language ? Pin
Rajesh R Subramanian11-Oct-06 0:09
professionalRajesh R Subramanian11-Oct-06 0:09 
AnswerRe: what is a strongly typed and loosely typed language ? Pin
David Crow11-Oct-06 7:44
David Crow11-Oct-06 7:44 
AnswerRe: what is a strongly typed and loosely typed language ? Pin
Hamid_RT11-Oct-06 8:05
Hamid_RT11-Oct-06 8:05 
QuestionMultifile selection in a filedialog box using MFC Pin
zareee10-Oct-06 22:50
zareee10-Oct-06 22:50 

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.