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. Sending Multiple Network Streams Simultaneously...

Sending Multiple Network Streams Simultaneously...

Scheduled Pinned Locked Moved C#
questionsysadminjsontutorial
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.
  • T Offline
    T Offline
    Trapper Hell
    wrote on last edited by
    #1

    I am working on a RAT (Remote Administration Tool)... Below is an explanation and the question... If you'd like you can skip the rest and read the question :) [Program Explanation] A program working on the Admin-side sends a command to the Client-side program (through TCP/IP), and after interpreting the instruction, it does the requested action. For example, if the Admin-side sends "list drives", the Client-side program interprets the command and sends a string[] back to the Admin as a byte[]... The admin-side would convert the byte[] to a string[] That's no big deal... [End of Program Explanation] [Question] The question is... Can I send multiple Network Streams at one time, and each are separately recognized by the receiving-end? This is important if more than one task are performed at one time - such as getting a file and keyboard logs... (Since the conversion at the receiving-end needs to be made for the relevant response... Last I tried, I sent two different Network Streams exactly after each other and the receiving end had thought that it was the same stream!! - It resulted in total chaos ;) [End of Question] [Program Coding] To send a command, there are two important methods

    public byte[] Serialize(object oSerialize)
    {
    ms = new MemoryStream();
    bf = new BinaryFormatter();
    bf.Serialize(ms, oSerialize);
    return ms.ToArray();
    }

    public byte[] Serialize(object oSerialize)
    {
    ms = new MemoryStream();
    bf = new BinaryFormatter();
    bf.Serialize(ms, oSerialize);
    return ms.ToArray();
    }

    On the receiving end, a similar system is used, being Receive and DeSerialize... [End of Program Coding]

    M 1 Reply Last reply
    0
    • T Trapper Hell

      I am working on a RAT (Remote Administration Tool)... Below is an explanation and the question... If you'd like you can skip the rest and read the question :) [Program Explanation] A program working on the Admin-side sends a command to the Client-side program (through TCP/IP), and after interpreting the instruction, it does the requested action. For example, if the Admin-side sends "list drives", the Client-side program interprets the command and sends a string[] back to the Admin as a byte[]... The admin-side would convert the byte[] to a string[] That's no big deal... [End of Program Explanation] [Question] The question is... Can I send multiple Network Streams at one time, and each are separately recognized by the receiving-end? This is important if more than one task are performed at one time - such as getting a file and keyboard logs... (Since the conversion at the receiving-end needs to be made for the relevant response... Last I tried, I sent two different Network Streams exactly after each other and the receiving end had thought that it was the same stream!! - It resulted in total chaos ;) [End of Question] [Program Coding] To send a command, there are two important methods

      public byte[] Serialize(object oSerialize)
      {
      ms = new MemoryStream();
      bf = new BinaryFormatter();
      bf.Serialize(ms, oSerialize);
      return ms.ToArray();
      }

      public byte[] Serialize(object oSerialize)
      {
      ms = new MemoryStream();
      bf = new BinaryFormatter();
      bf.Serialize(ms, oSerialize);
      return ms.ToArray();
      }

      On the receiving end, a similar system is used, being Receive and DeSerialize... [End of Program Coding]

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      You can never be sure that the message sent is recieved as one piece at the client. To be sure, you may use some Start and End indentifier for each message you send. At the client side, write a function which makes sure that stream is completely recieved and if not retrieve the remaining message from the next received.

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      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