//Socket.h
#pragma once
#include <iostream>
#include <winsock2.h>
usingnamespace std;
constint STRLEN = 256;
class Socket
{
public:
WSADATA wsaData;
SOCKET LISTEN;
SOCKET ACCEPTSOCKET;
sockaddr_in ADDRESSES;
public:
Socket();
~Socket();
bool SendData( char* );
bool RecvData( char*, int );
void CloseConnection();
void GetAndSendMessage();
};
class ServerSocket : public Socket
{
public:
void Listen();
void Bind( int port );
void StartHosting( int port );
};
class ClientSocket : public Socket
{
public:
void ConnectToServer( constchar *ipAddress, int port );
};
And here is my error message:
On line 28 : error C2059: syntax error : 'constant'
I have done several searches that have lead me to believe that there is something wrong with my class, But I cannot figure it out. What could be causing this error message?
void listen()
{
WSADATA wsaData;
if (WSAStartup(MAKEWORD(iReqWinsockVer,0), &wsaData)==0)
{
// Check if major version is at least iReqWinsockVer
if (LOBYTE(wsaData.wVersion) >= iReqWinsockVer)
{
int listen = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
int bind( SOCKET listen, conststruct SOCK_ADDR* SOCKADDR_IN, int STRLEN );//******** ????
int recvfrom( SOCKET listen, char INC_DATA[], 256, 0, char SOURCEBUFFER[], 32 );//******** ???
}
WSACleanup();
}
}
What are those two lines???
The first is a function declaration not a function call.
The second is part declaration part function call.
Sorry, I was getting highly frustrated and trying things out to see what happened. Needless to say, that is not productive, so I am trying to figure out what is wrong before I smash something. I was adding const's and char's and int's and stuff all over the place