|
Helo every one,
I have devoleped an application in C# .Net through which I trasfer the data through Com Port. But the data can be easily captured using com port monitoring tools. Can any one help me to know how can we block the Com Port monitoring tools from capturing the data.
regards,
Sandeep
|
|
|
|
|
Just for a hint Why dont you Use Encryption...
Although You still need to fire wall your port or protect it.
|
|
|
|
|
Cbhkenshin's suggestion to use encryption is probably the best bet - There are so many ways a COM port monitoring tool could work it isn't feasible to make a program which would block them all.
Steve
|
|
|
|
|
You really can't. It's kind of like plugging hole in a pipe with your fingers. You've only got 10 of them and there are about 20 holes...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there an event having something to do with a tab change(organizational tab)? I need to update a list box when the user changes to a specific tab.
Thanks for the help!
|
|
|
|
|
Yes, SelectedIndexChanged.
|
|
|
|
|
I'm writing a program and I need to figure out how big any single data structure is but the programs' signature simply allows any thing of "object" type because I want to allow anything. How can I figure out how many bytes whatever is sent to the program is long? I tried looking at sizeof and stuff but it appears sufficiently different from C so I'm stuck and it requires unsafe which doesn't seem like the best thing. I can't find anything using the Type class with <obj>.GetType() or typeof(<obj>). I've done searches and I guess my problem is too general to search so I'm stuck.
This object can be a byte, character, string or an instance of a custom class or anything at all. I want to be as unrestrictive as possible. If it can't be done easily or at all, I'll probably revert back to C but I'm trying to learn C#. Thanks in advance, Nate.
|
|
|
|
|
Search for overloading, that sounds like what you are trying to do.
|
|
|
|
|
I know how to overload class and operators but that's not the goal. I'll state what I'm trying to do in the other thread so I only write it once.
|
|
|
|
|
What exactly are you trying to do? Why do you want to know the size of objects, are you doing custom marshalling of any sort?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I'm trying to read the size and then get to the bits of any instance of data so I can teach it to a neural network. That way I can not only teach it strings, but also pictures for facial recognition, or other things, like maybe voice, or I can use it for error correction. I'm sure someone else has done it but I'm trying to learn C# and this is my project. If no one else has, I'll likely make it my first submission on here for others to see.
I've seen "marshall" in class roots on help pages but I don't know what that is.
|
|
|
|
|
|
Looks promising at a glance. I've been looking into just what marshaling is about and it's starting to gel, and this will help, thanks. Looking at the Marshal class seems to be just what I'm looking for, accessing the raw data.
|
|
|
|
|
Hello everybody, I tryed to make a software that check for updates:
Client: Login ( username , password ) , Receive update list , request updating files , get files , execute another process.
Server: Receive login , login on data-base if possible , send update list if logged , send requested files , logout.
Everythings are done, if I run CLIENT and SERVER on local computer, everythings works fine, but if I run SERVER on my computer, and CLIENT in another computer, the UPDATE doesnt work fine.
What happens:
Server can send any Text file good, in perfect state, but if I send binary files like JPG images, EXE, or any other things that arent TEXT FILES, it sends wrong BYTES, like if server is encoding all bytes to TEXT format...
===
CLIENT GET FILE VOID:
<br />
<br />
private void GetFile ( int FileNumber )<br />
{<br />
string FilePath = UpdateFileList[FileNumber];<br />
long FileSize = UpdateSizeList[FileNumber];<br />
<br />
long CurrentSize = 0;<br />
<br />
if ( FilePath.IndexOf("\\") > 0 )<br />
{<br />
string newDirectory = FilePath.Substring(0,FilePath.IndexOf("\\"));<br />
<br />
if ( !Directory.Exists(newDirectory) )<br />
Directory.CreateDirectory(newDirectory);<br />
}<br />
<br />
FileStream FS = new FileStream(FilePath,FileMode.Create,FileAccess.Write);<br />
<br />
while ( CurrentSize < FileSize )<br />
{<br />
try<br />
{<br />
this.Stats_Text.Text = "Downloading updatings ( " + (FileNumber+1) + " / " + UpdateFileList.Length + " )\n" + FilePath + " ( " + Convert.ToByte((Convert.ToDouble(CurrentSize)/Convert.ToDouble(FileSize))*100) + " % completed of " + (FileSize/1024) + " KBs )";<br />
long PacketSize = FileSize-CurrentSize;<br />
<br />
if ( PacketSize > 128 )<br />
PacketSize = 128;<br />
<br />
byte[] Packet = new byte[PacketSize];<br />
<br />
NS.Read(Packet,0,Packet.Length);<br />
NS.Flush();<br />
<br />
FS.Write(Packet,0,Packet.Length);<br />
FS.Flush();<br />
<br />
CurrentSize += PacketSize;<br />
FS.Seek(CurrentSize,SeekOrigin.Begin);<br />
}<br />
<br />
catch<br />
{<br />
try { File.Delete(FilePath); }<br />
catch {}<br />
<br />
this.Stats_Text.Text = "The connection with the Server was lost";<br />
Disconnect();<br />
}<br />
}<br />
<br />
FS.Close();<br />
}<br />
<br />
===
SERVER SEND FILE VOID:
<br />
<br />
private void SendFile ( int FileNumber )<br />
{<br />
Console.Write("US - Sending updating file : " + (FileNumber+1) + " / " + Owner.UpdateFileList.Length + " [ " + ClientUserName + " ]\n");<br />
<br />
string FilePath = Owner.UpdateFileList[FileNumber];<br />
long FileSize = Owner.UpdateSizeList[FileNumber];<br />
<br />
long CurrentSize = 0;<br />
<br />
FileStream FS = new FileStream(FilePath,FileMode.Open,FileAccess.Read);<br />
BinaryReader BR = new BinaryReader(FS);<br />
<br />
while ( CurrentSize < FileSize )<br />
{<br />
try<br />
{<br />
long PacketSize = FileSize-CurrentSize;<br />
<br />
if ( PacketSize > 128 )<br />
PacketSize = 128;<br />
<br />
byte[] Packet = new byte[PacketSize];<br />
Packet = BR.ReadBytes(Convert.ToInt32(PacketSize));<br />
<br />
NS.Write(Packet,0,Packet.Length);<br />
NS.Flush();<br />
<br />
CurrentSize += PacketSize;<br />
}<br />
<br />
catch<br />
{<br />
Disconnect();<br />
}<br />
}<br />
<br />
BR.Close();<br />
FS.Close();<br />
}<br />
<br />
===
Can someone help me plz? whats wrong on my code.
Thank you!
|
|
|
|
|
You could get a program like Ethereal and watch the traffic and see which side is corrupting the data for a start. That will let you narrow down which side is causing the problems and give you more information.
Other than that, check your properties and make sure your options are set properly. I had to deal with serial communications and it kept on screwing up at a certain character for seemingly no reason. The fix was that I forgot to set some ancient option buried in documentation.
|
|
|
|
|
Hello my friend, thank you very much, I tryed to hex the 2 files, look what happens:
Real File:
$121C ... 3B 00 CE 8B BE FE ...
Downloaded File:
$121C ... 3B 00 00 00 00 00 .... CE 8B BE FE ...
Its like add '00 00 00 etc' in the mid of file.
I am verifying right now if the CLIENT BUFFER is bigger than the packet, I ll check whats going on.
Thank you for the help.
if you know whats wrong, tell me, thx!
|
|
|
|
|
Its working now, I had to modify my code:
Server:
<br />
...<br />
<br />
NS.Write(Packet,0,Packet.Length);<br />
NS.Flush();<br />
<br />
Thread.Sleep(5);<br />
CurrentSize += PacketSize;<br />
<br />
...<br />
Client:
<br />
...<br />
<br />
NS.Read(Packet,0,Packet.Length);<br />
NS.Flush();<br />
<br />
Thread.Sleep(5);<br />
CurrentSize += PacketSize;<br />
<br />
...<br />
How ever, maybe 5 MS wont be enough, maybe 5 MS will be more than enough...
Is there a METHOD to wait until the CLIENT receive all the packet?
like: NS.Wait();
Thank you.
-- modified at 11:31 Sunday 5th March, 2006
|
|
|
|
|
When I did serial communications, the hardest part was to efficiently handle the data which is what you're against, but that was in VC++ not C# but I'll take a shot in the dark.
According to the NetworkStream documentation (which I assume you are using), there's a property called DataAvailable. Why not poll that property, when it's true, read the data?
I don't know how you make sure you transmit all the bytes efficiently, but think about this:
on a client connection:
1. server -> open file, capture file length as a 64-bit (8-byte) unsigned integer
2. server -> transmit the 8-bytes, client expects the same 8 bytes
(at this point, the client knows how many bytes it'll receive)
3. client -> simply loop until the recv'd byte count matches what it's expecting
Loop these 3 steps for each file you want to send.
The most efficient communications code I've written is code that's very flexible but powerful. This includes making sure both sides are constantly at the same step in communication. In VC++, I used the timeout features of events inside of threads.
Good luck.
|
|
|
|
|
Thank you my friend, I ll think about it
I ll test this property called DataAvaible.
Bye and really thank you.
|
|
|
|
|
Hi,
I am planning to import dll files ( created in C# by myself ) from SQL. Is it possible at all ?
Developing for Windows C# 2005 Express (.net 2.0)
|
|
|
|
|
It could be possible...
If you store into the database the bytes that are contained by your dll, and at the querry time you create a dll file with the contents of you field into the database.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Hi,
How can I interact with a SysTreeView in another application? I'm writing an automation application, and I need to access and iterate over the contents of a SysTreeView that belongs to another application. I also need to emulate mouse clicks on the tree view items.
I believe I need to do it by sending window messages to the control, but how do I do that with C# and .NET?
I'm using .NET 2.0 by the way.
thanks
/luddet
|
|
|
|
|
i need to open a very big image in my application then make some draw operation.
I need so to scrool it like photoshop does.
What is the easier way and no sources expensive?
|
|
|
|
|
Use a scrollable control like a panel forexample.
set AutoScroll property of the panel to true. Add a picturebox control onto your panel and set SizeMode to AutoSize. Do NOT set Dock property of picturebox to any value. Set location of your picturebox to 0,0 which places it to the topleft corner of the parent panel. That's all.
|
|
|
|
|
I was browsing the internet the other day and I ended up at a website that had a keylogger as one of its products. Anyhoo it said that it could make the program virtually invisible to users.
My question is: How would I make a program disappear from the process list under task manager?
|
|
|
|