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. Binding socket fails

Binding socket fails

Scheduled Pinned Locked Moved C / C++ / MFC
wpfwcfsysadminquestion
3 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.
  • W Offline
    W Offline
    willempipi
    wrote on last edited by
    #1

    SOCKET server; WSADATA wsaData; sockaddr_in local; ServerStart = TRUE; int wsaret = WSAStartup(0x101, &wsaData); if (wsaret != 0) { return 0; } local.sin_family = AF_INET; local.sin_addr.s_addr = INADDR_ANY; local.sin_port = htons((u_short)20248); if (bind(server, (sockaddr*)&local, sizeof(local)) == SOCKET_ERROR) { return 0; } What am i doing wrong?

    M 1 Reply Last reply
    0
    • W willempipi

      SOCKET server; WSADATA wsaData; sockaddr_in local; ServerStart = TRUE; int wsaret = WSAStartup(0x101, &wsaData); if (wsaret != 0) { return 0; } local.sin_family = AF_INET; local.sin_addr.s_addr = INADDR_ANY; local.sin_port = htons((u_short)20248); if (bind(server, (sockaddr*)&local, sizeof(local)) == SOCKET_ERROR) { return 0; } What am i doing wrong?

      M Offline
      M Offline
      Mike Nordell
      wrote on last edited by
      #2

      willempipi wrote: What am i doing wrong? Perhaps you could try creating the socket before you try to bind it.

      W 1 Reply Last reply
      0
      • M Mike Nordell

        willempipi wrote: What am i doing wrong? Perhaps you could try creating the socket before you try to bind it.

        W Offline
        W Offline
        willempipi
        wrote on last edited by
        #3

        thnx

        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