ccubed
June 27th, 2007, 12:19 AM
I found out where the Access Violation is. Thing is, i'm not usre why it's wrong. What's wrong with this code.
LPHostEnt = gethostbyname(address.c_str());
sin.sin_family = AF_INET;
sin.sin_addr = *((LPIN_ADDR)*LPHostEnt->h_addr_list);
sin.sin_port=htons(port);
The part in bold is where the problem is. also, LPHostEnt is a member of NSock. so, NSock.LPHostEnt. Here's the private part of NSock. The above is also a function within NSock.
int port;
int datasize;
int error_ret;
LPHOSTENT LPHostEnt;
WSADATA WsaData;
WORD WVer;
std::string address;
SOCKET Nova;
int MXBUFA;
struct sockaddr_in sin;
LPHostEnt = gethostbyname(address.c_str());
sin.sin_family = AF_INET;
sin.sin_addr = *((LPIN_ADDR)*LPHostEnt->h_addr_list);
sin.sin_port=htons(port);
The part in bold is where the problem is. also, LPHostEnt is a member of NSock. so, NSock.LPHostEnt. Here's the private part of NSock. The above is also a function within NSock.
int port;
int datasize;
int error_ret;
LPHOSTENT LPHostEnt;
WSADATA WsaData;
WORD WVer;
std::string address;
SOCKET Nova;
int MXBUFA;
struct sockaddr_in sin;