Ok, im having some problems transfering some functions that worked before into a single header and then making them so that they can be reused. These all worked before with out the variables Im trying to add. Can you see what im doing wrong?
Example, this section of code
Code:
//---------------------------------------------------------------------------
// XNET_ClientStartup
//---------------------
// This function initiates the XNET Client.
// iport is the port number that you wish to connect to.
// sipaddress is the ip address you wish to connect to.
//---------------------------------------------------------------------------
void XNET_ClientStartup(HANDLE &hsocket, int iport, LPSTR sipaddress){
WSADATA wsaData;
WSAStartup(MAKEWORD(1,1), &wsaData);
hsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
SockAddr.sin_port = htons(iport);
SockAddr.sin_family = AF_INET;
SockAddr.sin_addr.s_addr = inet_addr(sipaddress);
if (connect(hsocket, (SOCKADDR *)(&SockAddr), sizeof(SockAddr)) != 0)
{
MessageBox(NULL,dbStr(WSAGetLastError()),"XNET Error",MB_OK);
}
}
makes these errors
Code:
c:program filesincludexnet.h(27) : error C2440: '=' : cannot convert from 'unsigned int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:program filesincludexnet.h(29) : error C2065: 'SockAddr' : undeclared identifier
c:program filesincludexnet.h(29) : error C2228: left of '.sin_port' must have class/struct/union type
c:program filesincludexnet.h(31) : error C2228: left of '.sin_family' must have class/struct/union type
c:program filesincludexnet.h(33) : error C2228: left of '.sin_addr' must have class/struct/union type
c:program filesincludexnet.h(33) : error C2228: left of '.S_un' must have class/struct/union type
c:program filesincludexnet.h(33) : error C2228: left of '.S_addr' must have class/struct/union type
c:program filesincludexnet.h(35) : error C2664: 'connect' : cannot convert parameter 1 from 'void *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast