المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Sending Multiple Network Streams Simultaneously...



C# Programming
06-13-2009, 02:11 PM
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 http://barakasoft.com/script/Forums/Images/smiley_smile.gif

[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 http://barakasoft.com/script/Forums/Images/smiley_wink.gif
[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]