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. CAsyncSocket serverSocket;

CAsyncSocket serverSocket;

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

    Hi, I want to create a server that listens on a particular port for clients. Once the client connects, the server will send data. I have created CAsyncSocket serverSocket; serverSocket.Create(8000); serverSocket.Listen(1); //In function OnAccept ..OnAccept(int nErrorCode) { serverSocket.Accept(sendSock, NULL, NULL); . . } My Problem is OnAccept never gets called, when I start up my client Any help!!!!!!! thanx Gaurav

    S 1 Reply Last reply
    0
    • G gsc18

      Hi, I want to create a server that listens on a particular port for clients. Once the client connects, the server will send data. I have created CAsyncSocket serverSocket; serverSocket.Create(8000); serverSocket.Listen(1); //In function OnAccept ..OnAccept(int nErrorCode) { serverSocket.Accept(sendSock, NULL, NULL); . . } My Problem is OnAccept never gets called, when I start up my client Any help!!!!!!! thanx Gaurav

      S Offline
      S Offline
      sam India
      wrote on last edited by
      #2

      CAsyncSocket clienSocket; clienSocket.Create(8001);//or any integer clienSocket.Connect(8000); execute this code on a click event of a dialog box then the onAccept of server will get executed automatically. its better derive to 2 different classes from CAsyncSocket as CMyClientSocket and CMyServerSocket instead of directly using the object of CAsyncSocket. never say die

      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