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. problem receiving data from

problem receiving data from

Scheduled Pinned Locked Moved C#
csharpjavasysadminhelp
4 Posts 4 Posters 1 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
    Shivendra Pandey
    wrote on last edited by
    #1

    i got assignment to write a program(Server) for port listner the client program is written in java. the client will send 69 byte that will be received by server and then processed. i have written a simple TCP listner progam in c# but it always read upto 52 bytes and next 17 bytes are always 0

    OriginalGriffO M J 3 Replies Last reply
    0
    • S Shivendra Pandey

      i got assignment to write a program(Server) for port listner the client program is written in java. the client will send 69 byte that will be received by server and then processed. i have written a simple TCP listner progam in c# but it always read upto 52 bytes and next 17 bytes are always 0

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      So, cut out the relevant bits, and post them here (within <pre>...</pre> blocks) - otherwise we can't tell what your problem might be...

      All those who believe in psycho kinesis, raise my hand.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • S Shivendra Pandey

        i got assignment to write a program(Server) for port listner the client program is written in java. the client will send 69 byte that will be received by server and then processed. i have written a simple TCP listner progam in c# but it always read upto 52 bytes and next 17 bytes are always 0

        M Offline
        M Offline
        Migounette
        wrote on last edited by
        #3

        Do you have TCP no delay set ? SetSocketOption(SocketOptionLevel.Tcp ,SocketOptionName.NoDelay, true); It should not help in your case except if you made a mistake in your read operation. TCP is a reliable stream delivery service that guarantees delivery of a data stream sent from one host to another without duplication or losing data but you may see your data cut in several packets. So, handling of re-assembly packets is necessary at the application level. When the system is not loaded it's okay, but you will see when a system is at 99% of CPU usage it's not the same. Hope it helps.... Just let me know

        1 Reply Last reply
        0
        • S Shivendra Pandey

          i got assignment to write a program(Server) for port listner the client program is written in java. the client will send 69 byte that will be received by server and then processed. i have written a simple TCP listner progam in c# but it always read upto 52 bytes and next 17 bytes are always 0

          J Offline
          J Offline
          Jim Crafton
          wrote on last edited by
          #4

          Is your recv or read function giving you back a total of 69 bytes? If so then the TCP part of the socket read is OK, and the "problem" lies on the server end in terms of what it's sending you. It's entirely possible that the server is in fact sending you 69 bytes, 52 of which are printable characters, and the remaining 17 padded out as 0's. A 0 is a perfectly valid byte value to send across a network.

          ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

          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