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. Help needed for CSocket

Help needed for CSocket

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionsysadmin
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.
  • S Offline
    S Offline
    sumon2002
    wrote on last edited by
    #1

    I want to use CSocket. but when i called Create() function, it always return 0, i gave the following code fragment here. what is the wrong? did i do any mistake? Help is needed. if you can provide me sample code i will be happy. CSocket serverSocket, clientConnection; if(!serverSocket.Create(4001)){ m_StaticText.SetWindowText("Server Create error..."); return; } if(!serverSocket.Listen()){ m_StaticText.SetWindowText("Server Listen error..."); return; } if(!serverSocket.Accept(clientConnection)){ m_StaticText.SetWindowText("Server Accept error..."); return; }

    L 1 Reply Last reply
    0
    • S sumon2002

      I want to use CSocket. but when i called Create() function, it always return 0, i gave the following code fragment here. what is the wrong? did i do any mistake? Help is needed. if you can provide me sample code i will be happy. CSocket serverSocket, clientConnection; if(!serverSocket.Create(4001)){ m_StaticText.SetWindowText("Server Create error..."); return; } if(!serverSocket.Listen()){ m_StaticText.SetWindowText("Server Listen error..."); return; } if(!serverSocket.Accept(clientConnection)){ m_StaticText.SetWindowText("Server Accept error..."); return; }

      L Offline
      L Offline
      laia
      wrote on last edited by
      #2

      use AfxSocketInit() to intilize the socket before use socket's function. and there are some samples in the MFC, such as chatter, it would be good to you. best regard. laia

      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