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#
  4. Socket Question

Socket Question

Scheduled Pinned Locked Moved C#
questionsysadminhelp
4 Posts 3 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
    gekoscan
    wrote on last edited by
    #1

    Okay I am seriously stumped.... There must be a way for a socket object to tell when it is done recieving a file... If we are just serializing a class and sending it between a client and a server and the object is 700 bytes.. How can I tell when the object is done sending... I am sending this object over and over... So i need to know when it begins and when it ends. Please help me out.. Please please please.... Thanks, Steve Nelson.

    S S 2 Replies Last reply
    0
    • G gekoscan

      Okay I am seriously stumped.... There must be a way for a socket object to tell when it is done recieving a file... If we are just serializing a class and sending it between a client and a server and the object is 700 bytes.. How can I tell when the object is done sending... I am sending this object over and over... So i need to know when it begins and when it ends. Please help me out.. Please please please.... Thanks, Steve Nelson.

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      Are you using synchronous or asynchronous sockets ? If it's synchronous, then you just do .Send or .Receive, and when the call returns, that's because it's done! (or failed miserably by the way). If it's asynchronous, you've got the IAsyncResult interface to subscribe for. More info here[^].

      G 1 Reply Last reply
      0
      • G gekoscan

        Okay I am seriously stumped.... There must be a way for a socket object to tell when it is done recieving a file... If we are just serializing a class and sending it between a client and a server and the object is 700 bytes.. How can I tell when the object is done sending... I am sending this object over and over... So i need to know when it begins and when it ends. Please help me out.. Please please please.... Thanks, Steve Nelson.

        S Offline
        S Offline
        stephen woolhead
        wrote on last edited by
        #3

        You need to add some control protocol to the stream. Very simple would be send a fixed number of bytes that contain the size of the object first, let the reciver read that, then read that number of bytes from the stream, then repeat. I do not suggest that you do something this simple in real life though, buu you get the picture? Stephen.

        1 Reply Last reply
        0
        • S Stephane Rodriguez

          Are you using synchronous or asynchronous sockets ? If it's synchronous, then you just do .Send or .Receive, and when the call returns, that's because it's done! (or failed miserably by the way). If it's asynchronous, you've got the IAsyncResult interface to subscribe for. More info here[^].

          G Offline
          G Offline
          gekoscan
          wrote on last edited by
          #4

          Thank you so much.. examples... oman!! Was going insane seriously.. Thanks again a million times. Sincerely, Stephen.

          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