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 - can't get Sever/Client to talk over sockets

Help - can't get Sever/Client to talk over sockets

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminhelpquestion
1 Posts 1 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
    glweid
    wrote on last edited by
    #1

    I'm trying to get a very basic Client-Sever app using sockets to communicate (Below are the code snipets). First I start the server, it connects to port 6001 and waits. The client starts up and connects and sends a string, the server accepts the connection and tries to read data into dwValue but I get nothing - they do not communicate after the connection, any ideas why ?? Thanks in advance !! ------------ Server Code: m_sockRecv = new CSocket; CString dwValue; CSocket sockSrv; sockSrv.Create(6001); sockSrv.Listen(); CSocket sockRecv; sockSrv.Accept(sockRecv); CSocketFile file(&sockRecv); CArchive arIn(&file, CArchive::load); CArchive arOut(&file, CArchive::store); arIn >> dwValue; Client Code: CString str = "9"; csocket.Create(); csocket.Connect("localhost",6001); CSocketFile file(&csocket); CArchive arIn(&file,CArchive::load); CArchive arOut(&file,CArchive::store); arOut << str;

    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