Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Strange things with parameters.

Strange things with parameters.

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelpworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    esepich
    wrote on last edited by
    #1

    There is surely something I do not understand here. I would very much appreciate if someone could explain to me how I screwed this up. Thank you. --------------------Configuration: TCPIPwatch - Win32 Debug-------------------- Compiling... TCPIPwatchDlg.cpp C:\DOCUMENTS AND SETTINGS\ADMIN\DESKTOP\SSPROJECT\TCPIPwatch\TCPIPwatchDlg.cpp(235) : error C2664: 'bind' : cannot convert parameter 2 from 'struct CTCPIPwatchDlg::TCPIPWConnectSock::SOCKADDR_IN *' to 'const struct sockaddr *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. TCPIPwatch.exe - 1 error(s), 0 warning(s) void CTCPIPwatchDlg::TCPIPWConnectSock(SOCKADDR_IN *dest, SOCKET &theTrgSock) { dest->sin_family = AF_INET; dest->sin_port = 80; if(dest->sin_port == INVALID_SOCKET) AfxMessageBox("Port is invalid.",MB_OK); theTrgSock = socket(AF_INET, SOCK_RAW, IPPROTO_IP); const char RCVTIMEO[50] = "5000"; setsockopt(theTrgSock, SOL_SOCKET, SO_RCVTIMEO, (RCVTIMEO), 4); bind(theTrgSock, (struct SOCKADDR_IN*) dest, sizeof(dest)); }

    A 1 Reply Last reply
    0
    • E esepich

      There is surely something I do not understand here. I would very much appreciate if someone could explain to me how I screwed this up. Thank you. --------------------Configuration: TCPIPwatch - Win32 Debug-------------------- Compiling... TCPIPwatchDlg.cpp C:\DOCUMENTS AND SETTINGS\ADMIN\DESKTOP\SSPROJECT\TCPIPwatch\TCPIPwatchDlg.cpp(235) : error C2664: 'bind' : cannot convert parameter 2 from 'struct CTCPIPwatchDlg::TCPIPWConnectSock::SOCKADDR_IN *' to 'const struct sockaddr *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. TCPIPwatch.exe - 1 error(s), 0 warning(s) void CTCPIPwatchDlg::TCPIPWConnectSock(SOCKADDR_IN *dest, SOCKET &theTrgSock) { dest->sin_family = AF_INET; dest->sin_port = 80; if(dest->sin_port == INVALID_SOCKET) AfxMessageBox("Port is invalid.",MB_OK); theTrgSock = socket(AF_INET, SOCK_RAW, IPPROTO_IP); const char RCVTIMEO[50] = "5000"; setsockopt(theTrgSock, SOL_SOCKET, SO_RCVTIMEO, (RCVTIMEO), 4); bind(theTrgSock, (struct SOCKADDR_IN*) dest, sizeof(dest)); }

      A Offline
      A Offline
      Anand Paranjpe
      wrote on last edited by
      #2

      Hi, typecast with (const ::SOCKADDR*) to 2nd parameter for function bind(). Cheers:) The chosen One :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups