|
I´ve createad a remote class that is registered with singleton access mode, so that all the clients access the same class instance. I´ve set my object lifetime so that the object don´t get destroyed until my hosting app finishes. I´ve connected 3 clients to the remote component so far. My question is: if I start to connect a large number of clients (let´s say 100 or 200) in this singleton-access-object, will remoting maintain the same instance to all my clients or it will create other instances for performance reasons ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
The alcohol is one of the greatest enemys of man, but a man who flee from his enemys is a coward.
|
|
|
|
|
Mauricio Ritter wrote:
My question is: if I start to connect a large number of clients (let´s say 100 or 200) in this singleton-access-object, will remoting maintain the same instance to all my clients or it will create other instances for performance reasons ?
From what I've heard with other people's results it will keep the same object for the entire duration of your hosting app.
Now the problem; you need to be careful in that nothing you do while remoting takes up *all* the CPU time; I've seen numerous reports that once that happens new connections are either denied or ignored until the processor becomes free.
I've seen a few suggestions but since I haven't looked 'in depth' into remoting I'm going only from (shaky) memory. First was that you should use Asynch delegates where possible. That means if you're waiting for something to happen create a delegate that does the waiting and fire it asynchronously (Begin/EndInvoke).
Hope that helps,
James
|
|
|
|
|
James T. Johnson wrote:
Now the problem; you need to be careful in that nothing you do while remoting takes up *all* the CPU time; I've seen numerous reports that once that happens new connections are either denied or ignored until the processor becomes free.
Interesting... will it deny my connection on the function calls or in the object instantiation ?
James T. Johnson wrote:
I've seen a few suggestions but since I haven't looked 'in depth' into remoting I'm going only from (shaky) memory. First was that you should use Asynch delegates where possible.
Hmmm... that´s a possibility...
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
The alcohol is one of the greatest enemys of man, but a man who flee from his enemys is a coward.
|
|
|
|
|
James T. Johnson wrote:
First was that you should use Asynch delegates where possible
I just have a thought... if I create a delegate and more than one user have this delegate installed in their class instances... since I´m working with a singleton object, will all the users receive the delegate notification ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
The alcohol is one of the greatest enemys of man, but a man who flee from his enemys is a coward.
|
|
|
|
|
Upon further investigation it looks like you don't *need* to have a delegate after-all.
Something like this (psuedo-code)
private delegate void DoWorkDelegate(WorkArgs e);
public void DoWork(WorkArgs e)
{
DoWorkDelegate dwd = new DoWorkDelegate(DoWorkReal);
IAsyncResult ar = dwd.BeginInvoke(e
null, null);
ar.AsyncWaitHandle.WaitOne();
if( ar.IsCompleted )
{
wdw.EndInvoke(ar);
}
}
private void DoWorkReal(WorkArgs e)
{
} Uncompiled code, but so much for my psuedo-code
HTH,
James
|
|
|
|
|
Hi!
I need to use SMTP server to send mail ...
I am trying to use program written by Agus Kurniawan "Sending mail via SMTP.." posted on this site... Code looks to be just fine .. but I am receiving error exception :
TcpClient SmtpServ = new TcpClient(ServSMTP.Text,25); string Data;
byte[] szData;
try
{
// initialization
NetworkStream NetStrm = SmtpServ.GetStream();
StreamReader RdStrm= new StreamReader(SmtpServ.GetStream());
LogList.Items.Add(RdStrm.ReadLine());
On the last line of listed code it bombs :
Value cannot be Null
Parameter name: item
Any suggestions what am i doing wrong?
SMTP server that i am trying to access: mail.mycompany.com
Please help
|
|
|
|
|
Hi David,
is it possible that something is wrong with "LogList.Items"?
did you try this?
string tempResult = RdStrm.ReadLine();
Sebastian
|
|
|
|
|
David37 wrote:
LogList.Items.Add(RdStrm.ReadLine());
The problem is that streams return null when the end is reached.
What you need to do is put the value of RdStrm.ReadLine() in a temporary value, then only add the value if it isn't null.
James
|
|
|
|
|
Thanks a lot guys...
But ... James, how come i have null all the time ...
Then, if I am commenting those lines out ...I am getting next error :
"Unable to write data to the transport connection" ... so when i am tracing I am getting that even net stream gets null ... No stream ... like something is definitely wrong ... or i don't see something..
Any suggestions?
Maybe my problem is SMTP Server itself :
TcpClient SmtpServ = new TcpClient(ServSMTP.Text,25); ????
Code :
NetworkStream NetStrm = SmtpServ.GetStream();
StreamReader RdStrm= new StreamReader(SmtpServ.GetStream());
tempResult = RdStrm.ReadLine();
if (tempResult != null)
{
LogList.Items.Add(tempResult);
}
// say hello to server and send response into log report
Data = "HELLO server " + CRLF;
szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
NetStrm.Write(szData,0,szData.Length);
//LogList.Items.Add(RdStrm.ReadLine());
|
|
|
|
|
Hello all.
I don't know C#,(and english too!), I'm starting with .net.
I'd like to know if in C# is possible do these 2 things:
Read who(user or groups) have access permission to a specific file or folder
and how(read,write,execute).
Second, is possible access other usefull information stored in indexing server about a file like the Author,Comments,Version,Company ecc. ecc.
I have searched a class to do this in .NET Framework without success.
I don't need the solution but at least a little help how to start.
Thanks, thanks in advance!!!
Sergio Bertini
|
|
|
|
|
serberwww wrote:
Read who(user or groups) have access permission to a specific file or folder
and how(read,write,execute).
Second, is possible access other usefull information stored in indexing server about a file like the Author,Comments,Version,Company ecc. ecc.
I think for this purpose you have to use API.
For getting file attribute you can use FileAttributes class.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
API? with c# and .NET is possible?
mmm, with FileAttributes I can access all these properties:
Archive = 0x00000020,
Compressed = 0x00000800,
Device = 0x00000040,
Directory = 0x00000010,
Encrypted = 0x00004000,
Hidden = 0x00000002,
Normal = 0x00000080,
NotContentIndexed = 0x00002000,
Offline = 0x00001000,
ReadOnly = 0x00000001,
ReparsePoint = 0x00000400,
SparseFile = 0x00000200,
System = 0x00000004,
Temporary = 0x00000100,
I'd like extract other usefull info in the file that
are also indexed by the index server.
How?
Sergio Bertini
|
|
|
|
|
serberwww wrote:
API? with c# and .NET is possible?
OF course,but not very easy and I don't like it. For an example check this:
DriveComboBox
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
If you are talking about an a computer on a network using Active Directory, then the System.EnterpriseServices namespace of classes might help you.
Knowing next to nothing about the Active Directory model; thats all I can offer.
HTH,
James
|
|
|
|
|
No, I want to read them on a local computer.
Or, How can I know if a User/Group have
access to a file or folder?
Ciao
Sergio Bertini
|
|
|
|
|
Is it possible to run C# apps on windows 98? When I try it complains about not being able to find the MSCOREE dll, but I cant install the SDK to get it there, can I?
Thanks
|
|
|
|
|
Anonymous,
I have executed C# applications on Win98 with the runtime installed. Did you download the runtime or install it from the MSDN?
Rich
|
|
|
|
|
You need to atleast install the .NET resdistributable. You can't install SDK to development but you can run .NET apps
|
|
|
|
|
All,
For a while, I have searched for information creating and using "grab handles." At this point, the only thing I have found is some weak information on the MSDN on DrawGrabHandle. Does anyone know of a good resource for this?
Thanks In Advance,
Rich
|
|
|
|
|
I got the following code:
using System;
namespace AbelSoft.LudoGame
{
///
///
///
public class Piece : System.Drawing.Image
{
public Piece()
{
}
}
}
and this is the error i got:
C:\Documents and Settings\Franck-Alain\My Documents\Visual Studio Projects\LudoGame\Piece.cs(10): 'System.Drawing.Image.Image()' is inaccessible due to its protection level
|
|
|
|
|
franck_alain wrote:
'System.Drawing.Image.Image()' is inaccessible due to its protection level
This looks like it is a sealed class, hence you would not be able to derive your own class from it.
If you need a graphics object, you can override the OnPaint method.
Nick Parker
|
|
|
|
|
Why is it that when I right click on a tree node and my context menu pops up, the item that is returned by the treeView1.SelectedNode property is not the item that was right-clicked on, but whatever tree node happend to be selected before the right click?
i.e.
Folders
_________
|FolderA| <-- Currently selected tree node
---------
FolderB
FolderC <-- Right click here
treeView1.SelectedNode returns FolderA, not FolderC, even thought the selected node highlighting box temporarily moved to FolderC.
Scratching my head...
Thanks,
Rick
|
|
|
|
|
Thats just the way the TreeView works. Crappy answer, but if you look at the behavior in Windows Explorer it is the same.
I believe the justification is that selecting the node is so you can tell which node was right-clicked on. Right clicking should not select an item; you are merely requesting a menu to popup.
James
|
|
|
|
|
I have to disagree, at least w/respect to how Windows Explorer works. If I left click Folder "A" in explorer to select it, then right click on folder "B" and select "properties" I get a property page for folder "B", not folder "A".
This is the behaviour on Windows 2000.
If I were programming with pure Win32, I would just do a hit-test on the item under the mouse cursor, but I can't find an analog in C#.NET.
Thanks,
Rick
|
|
|
|
|
rhoward wrote:
If I left click Folder "A" in explorer to select it, then right click on folder "B" and select "properties" I get a property page for folder "B", not folder "A".
Correct, but when you close the property page the folder "B" *isn't* selected, folder "A" is. Sorry I didn't make that clear in my posting.
James
|
|
|
|