Third party Server to Client - Recv function question
I have created a client to receive information from a third party server, but I am unsure of how to use the Recv function.
I have created and initialized the socket parameters, and I'm attempting to receive the data from the server. Here is my current code for receiving information:
uint8 * data = NULL; uint32 size = 1000; int32 bytes_read; ESocketReceiveFlags::Type flags;
Socket->Recv( data, size, bytes_read, flags);
The code errors with 'flags' stating that the variable is uninitialized and that "no 'object' file generated". How do I set up this flags variable to use the Recv function? Are there any future problems that anyone could see occurring?
Thanks for your help and feedback.
asked Jun 03 '14 at 03:00 PM in C++ Programming
In the vast majority of cases
There is another issue I see with your code - Recv does not allocate memory for the caller. Make sure that the "data" value passed in can store
Also a general comment on networking - any case where you receive data over the network is a potential security risk. This is a huge topic beyond the scope here, but briefly it's good practice to sanity-check the data received: range-check numbers, make sure strings are terminated, and so on.
answered Jun 03 '14 at 03:33 PM
Ryan Gerleve STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here