I'm new to c++ and these forums, so dont get too complex with me
Basically, i'm trying to build a program to communicate with a gameserver. When recieving data from the server a 'header' packet is sent first, 8 bytes in length. The first 4 bytes are an int32 value representing the number of bytes that will be sent in the 'body'. The last 4 are also an int32 value of a handle which is used for asynchronous communication.
I have been able to put together a simple program which can connect to the server and recieve the handshake. To do this I used the handy socket programing tutorial found here. The method it describes for recieving data uses the recv function...
However, despite the fact it states buf is of void type (I assume that means it will take more than one type), I can only seem to make buf as a char type or the compiler will complain. This does not matter for the handshake because a) I know the exact length of it, and b) the header is only 4 bytes as it requires no handle.Code:int recv(int sockfd, void *buf, int len, unsigned int flags);
To continue with my programing I need a way to get the 8 bytes from the header into 2 seperate int values. Any suggestions would be appreciated