|
Is there a way to do this using .net 2
thx
|
|
|
|
|
Try this[^].
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi guys
I have problem running a remote WMI query in my threaded application.
What I am doing is querying allot of clients 5000+ in our network, after a while WMI starts returning wired random exceptions like RPC service is not available.
I’m using C# .NET 2.0
I’m using the Treading.Treadpool.
WMI is working fine on the clients. Both remote and locally.
It’s W2k clients
So basically my question is doesn’t WMI play nice in a multithreaded environment?
/Johan
|
|
|
|
|
What are some of the other exceptions? Are you cleaning up the WMI connections correct? From a command prompt you can run "netstat -an" to see if your local box has lots of ports open (LISTENING) or in TIME_WAIT.
I'm assuming you are not reusing the same WMI object in more than one thread at a time.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi Tom
Thanks for the reply. I have allot of ports in TIME_WAIT. They dosent seem to be relesed. I dont know why they dont get relesed.
Do i need to do anything more??
public bool ServiceRunning(string n, string q)
{
ConnectionOptions co = new ConnectionOptions();
TimeSpan ts = new TimeSpan(1000);
co.Timeout = ts;
ManagementScope ms = new ManagementScope("\\\\" + n + "\\root\\cimv2", co);
ObjectQuery oQuery = new ObjectQuery(q);
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher(ms, oQuery);
ManagementObjectCollection objCol = null;
try
{
objCol = oSearcher.Get();
_WMIStatus = "WMI Running";
if (objCol.Count > 0)
{
return true;
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
objCol.Dispose();
oSearcher.Dispose();
}
|
|
|
|
|
The TIME_WAITs are normal[^] but you may be opening and closing too many connections too quickly. If you read this[^] you will see it says you are basically limited to ~200 connections a second. You can adjust the time wait period at your own risk though.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi Tom
Thanks allot for your help.
/Johan
|
|
|
|
|
hi,
let suppose
bmp = new Bitmap(530, 335);
I think it’s means that bmp is consist of 530 x 335 pixels.
Am I right ?
|
|
|
|
|
Yes 530 is pixels width and 335 is height.
|
|
|
|
|
You are correct.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
|
Or even looked at the constructor tooltip when typing. It's the 5th overload of the constructor out of 12. Says very clearly Bitmap.Bitmap(int width, int height)
|
|
|
|
|
Or even checked the .Width or .Height of the bitmap after construction.
|
|
|
|
|
I am working with large files in a compressed state. From what I can find it is not possible to copy compressed files without uncompressing first. Does anyone know if it is possible to copy compressed files compressed? As I am writing the code in C# I have included the question here.
Thanks for any help.
Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
What do you mean by "copy"?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
The archive contains 3-7 files, if a change is made to one file the old archive is maintained "as is" and a new one with the change is created. The files which were not changed need to be added to the new archive, or copied.
Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
to modify the contents of a compressed archive it will need decompressed and recompressed afterwards. I suspect you can find a library that will hide the details for you.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
What library are you using to create your archives?
Technically, it's possible to copy a file from one archive (e.g. a .zip file) to another archive without decompressing it first. But this really depends on the archive's format. For example, I think you can do it with .zip files, but other formats I'm not sure. In reality, I'm not sure if archive libraries have this type of feature.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I have been working mostly with #ZipLib which does use the .zip files. Any thoughts on where I can look for how to do the copy compressed?
Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
I haven't tested this, but it looks liks you can get the ZipEntry from the first archive and add it to the second archive. You may need to Clone the ZipEntry.
Let me know if this doesn't work.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
That does the trick, thanks
Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
jimwawar wrote: Does anyone know if it is possible to copy compressed files compressed?
I would guess that the methods for copying just any file would work fine.
Nathan
|
|
|
|
|
What I have been able to find and play around with, as soon as the compressed file is put on a stream for copying it is uncompressed. To put it into another archive requires re compression. As the file sizes are gig this is a heavy time/cpu crunch. If the copying could be done compressed the time/cpu would be saved.
Jim
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
double zip the files?
ie zip each file separately at your chosen level of compression, and then use a 0% compression outer zip as a container. Inserting/extracting from the outer zip should be no more expensive than any other file copy operation.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
you can copy an compressed bytestream just as easily as an uncompressed one. The copy will also be compressed. If you want an normal copy you'll need to decompress it first.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|