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. File Transfer-- Binary Data

File Transfer-- Binary Data

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiontutoriallounge
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.
  • P Offline
    P Offline
    Pett
    wrote on last edited by
    #1

    Hi, I'm new to C++/MFC. I have an assignment to modify the Chat program from the MSDN site (Chatter and Chatsrvr) to cater for file transfer. I need to determine between data that is being sent over the socket as text (the messages) versus the binary data that is to be sent over as the file. There is a void CClientSocket::OnReceive(int nErrorCode) looks like an overrided method from the CSocket class. So basically whenever the socket receives something, it kicks off the OnReceive code. It calls the ProcessPendingRead method , which then treats the received data as a Message (text) versus a binary file. How can I switch between data the text for the messages and the binary data for the file when I'm doing the file transfer?:(( Any ideas on how to make this work? Pett

    A 1 Reply Last reply
    0
    • P Pett

      Hi, I'm new to C++/MFC. I have an assignment to modify the Chat program from the MSDN site (Chatter and Chatsrvr) to cater for file transfer. I need to determine between data that is being sent over the socket as text (the messages) versus the binary data that is to be sent over as the file. There is a void CClientSocket::OnReceive(int nErrorCode) looks like an overrided method from the CSocket class. So basically whenever the socket receives something, it kicks off the OnReceive code. It calls the ProcessPendingRead method , which then treats the received data as a Message (text) versus a binary file. How can I switch between data the text for the messages and the binary data for the file when I'm doing the file transfer?:(( Any ideas on how to make this work? Pett

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Hi, for example make a new client socket that does not send/receive chat text, but instead only receives (binary) data. You can derive a new class from your CClientSocket, so it's more clear that this class has a single purpose (downloading files). On the server side you might need to add more handshake to distinguish between incoming clients and incoming file requests (I don't know what Chatter and Chatsrvr do). Propably you wanted to transfar text and binary data via one socket... but this might not be good if transfering bigger files. While transfaring the user couldn't chat anymore and the server can't send chat text. Creating a new socket for file transfar solves this problems. Hope it helps, Moak

      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