visual studio 2012 - How to set a socket option in C++ using setsockopt -


still, having troubles code.

if (argc > 0) { int route (argc);//[argc+1] ((char*) route)[0] = 1; ((char*) route)[1] = 2;//131 ((char*) route)[2] = 3 + argc * 4; ((char*) route)[3] = 4; (int = 0; < argc; i++) {     route = inet_addr(argv[i]); }  if (setsockopt(_socket.native_handle(), ipproto_ip, ip_options, route, (argc + 1) * 4) < 0) {     perror("can't set socket option"); } } 

here's part of it, keep getting error c2664: cannot convert parameter 4 'int' 'const char *'

microsoft's implementation of setsockopt() has const char* fourth option. posix usually has const void*. has pointing buffer contains values. last argument size in bytes of buffer.

so this:

setsockopt(     _socket.native_handle(), ipproto_ip, ip_options,     reinterpret_cast<char*>(&route), sizeof(int)); 

i don't know enough sockets tell whether you're passing makes sense. here's documentation on msdn ip_options.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -