|
Must first establish a connection, and then assign
|
|
|
|
|
please help me!
Client/Server and browser/Server how the Communication ?
|
|
|
|
|
I appreciate that English is not your first language, but this is still a very vague and meaningless question. The core answer is HTTP and TCP/IP I suspect. I also suspect that's not the question you meant to ask.
If you write a client/server app you need to write code to connect to the server. Your browser does that for you, obviously, you just need to set up a web host connected to the right URL with the code for a website.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I need to create a tool, that would be able to "attatch" or launch other .net process and crash it in very special way
I want to be able to refuse the other process eg. access to file system, simulate out of memory exception, simulate lack of network connection etc.
All this is for testing purposes to verify that developer handled all this corner cases in his application and that this application crashes gracefully
My first thoughts are to use Mono and hook up into virtual machine or visual studio debugger.
Another idea was to use impersonation and during runtime change privileges of user running other application but i'm not sure if i'll be able to make runtime throw appriopriate exceptions eg. outofmemoryexception...
What do you think about approach? any sugestions or recomendations ? reasons why it doesn't have any sense or won't work?
Have you ever came across simmilar tool/problem/anything simmilar?
Thanks for you comments
Lukasz
|
|
|
|
|
I have created an object that, given a reference to a DataGridView will print it. I have one problem with my code, however. When I double-click the column separators to get the minimum size that will display all the contents of the columns and then print, not all of the content displays in the print. I need to figure out how to translate the on-screen column width to a printed width. Now, I know some of you are thinking "use MeasureString()". That would require two passes of my data to find the longest contents of the column. That is inefficient. There has to be (read as "please let there be") a way to simply convert the column width for printing purposes.
Any ideas?
|
|
|
|
|
Sometimes I have found that problems like this have been caused by the difference in dpi between the screen Graphics and the printer Graphics objects.
Not always though but it is worth looking at.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
They appear to be the same, when I look at the printerresolutions collection.
|
|
|
|
|
I have been using bothy generic lists and array lists, but I really don't see the difference. What is the difference between:
Customer cust = new Customer();
ArrayList customers = new ArrayList();
customers.Add(cust);
and
Customer cust = new Customer();
List<Customer> customers2 = new List<Customer>();
customers2.Add(cust);
Everything makes sense in someone's mind
|
|
|
|
|
Also
customers[3]
will return an object which has to be cast to be useful.
Whilst
customers2[3]
will return a Customer
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
ArrayList will be, in many aspects, the same as List<object>.
You can do: customers.Add(1); customers.Add("Test"); and customers.Add(cust);
When you get the value, it will be also a simple "object". So, if the Customer class has a name property, you will only be able to get the customer name doing:
((Customer)customers[0]).Name
instead of
customers2[0].Name
And, of course, you will get an exception if the first item is the 1 I added. But, the problem, you got the exception when getting the item, not when you were putting it into the list.
Also, there is more. For value types (the 1 is a value type) it will avoid boxing.
When you do arrayList.Add(1) it internally creates a full object (or box if you prefer) which contains the effective value type 1, and adds a reference to such box in the list.
If you do integerList.Add(1) (which is List<int>) you will add the 1 to the list. No reference. No additional object created.
|
|
|
|
|
Putting stuff in is fine; the difference is in getting stuff back out.
|
|
|
|
|
Such an eloquent, technically precise response!
|
|
|
|
|
hi guys
i dont know how to make thread in my program , please help me
i wanna know how to make , and work with threads , it`s better to use System.threading.thread
|
|
|
|
|
Thread myThread = new Thread(nameOfTheFunctionToExecuteHere);
myThread.Start();
This is enough to create a new thread and start it. You can, of course, set the name of the thread, the priority etc.
The nameOfTheFunctionToExecuteHere must be in the pattern:
void nameOfTheFunctionToExecuteHere()
{
}
or static void nameOfTheFunctionToExecuteHere()
{
}
You can also use void nameOfTheFunctionToExecuteHere(object parameter) but, in that case, you must call myThread.Start(parameter).
This will create an entire new thread. For small work that does not wait for any external events it is recommented that you use the ThreadPool.
To do that, call ThreadPool.QueueUserWorkItem(methodNameHere);
This will use reutilize the threads from the ThreadPool (it is faster than creating a full thread), but the ThreadPool is limited, so you must not "block undefinitelly" in these threads.
There are other differences, but I think you will find it by yourself.
|
|
|
|
|
After my application (heavy file IO on UNC address) is running a little bit it chrashes always with:
SystemIO Exception: The specified network name is no longer available.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.get_Length()
On this time the Share is also not reachable by explorer, sometimes the compleate system is chrashing,
on reboot I have then to kill the explorer.exe.
I think I use some resources too much. What is the best way to analyse this?
ProcessMonitor?
WinDbg? But how?
Thanks,
daniel
|
|
|
|
|
I don't know the best way to analyse this, but I have a possible solution.
Instead of reading and writing to, say "\\SomeComputer\SomeSharing\..." try creating a Remoting application.
The remoting application server will run in SomeComputer. Then, it always access everything as C:\ D:\ (or the apropriate local drive) and the clients access the remoting server application instead of the drive mapping. I did that when I started to have problems reading and saving files remotelly and all my problems where gone.
|
|
|
|
|
Hi,
I have a inbound named pipe in overlapped mode. The client connects and writes in the pipe created by the server.
The client is writing real-time data very fast in the named pipe, but the server is not reading the data fast enough.
This is creating a delay between what is happening in the real-time application and the data that is given by the read in the server.
If I decrease the rate at which the client writes to the named pipe, I get better results (the real-time application and the data read in the server tend to match) but by decreasing the rate I am not getting smooth data, meaning I am getting samples of data from the real-time application periodically.
On the other hand if I decrease the buffersize in the Named pipe, and the rate of writing to the named pipe is fast, the real-time application drags itself and gets very slow. I am guessing this is because the named pipe gets filled very fast and since it is Overlapped the data cannot be overwritten unless the slow reader finishes reading it.
So my problem is:
Case 1 - (fast write rate, large buffer): server read data and the real-time app are way off
Case 2 - (fast write rate, small buffer): application hangs
Case 3 - (slow write rate, *): server read data is not smooth (not acceptable)
Did anyone face similar problems? All suggestions are much appreciated.
|
|
|
|
|
PS: the blocking mode of the named pipe (one of the options in the third parameter when creating it) is PIPE_WAIT
modified on Wednesday, October 28, 2009 3:47 PM
|
|
|
|
|
I faced the same problem. And, to be honest, I faced another problem. I was using named pipes to communicate between 32bit and 64bit applications, and the data sent was not the same data that was received.
At that time I had created a remoting framework that was capable of using TCP/IP or IPC. I always thought IPC was faster but, after some benchmark, I discovered that TCP/IP was faster and didn't had any problems with 32/64 bits, so I gave up of using IPC.
Also, even in TCP/IP, I had the problem that only one thread can write to the stream. Even using locks before read and write, the internal buffers get lost and I got a lot of exceptions. So, one thing you can try, if you for some reason are using more than one thread to send the packets, is to send all the messages to one thread, and let that thread send the message to the IPC stream.
If this does not solve, try using TCP/IP. As I said, for me it was faster.
|
|
|
|
|
I was thinking in the similar line, using UDP though. Because I don't mind getting few packets dropped as the input stream is very fast. And also because I am thinking the TCP acknowledgments might cause some delays.
Named pipes are supposed to be pretty fast. I went through my code and there is nothing in the server that does huge processing to the received data. An event handler simply reads the data and sends it to another function. I wonder why it is reading slowly.
Did you figure out why yours was reading slowly?
Thank you for your suggestions.
|
|
|
|
|
No. But considering I changed it to TCP/IP and it went faster, I must say it is an IPC problem (maybe the .Net implementation of IPC is the problem). And, considering my primary use was TCP/IP and IPC was only as a "faster" alternative, I simple dropped IPC support.
I think you must try with tcp/ip (or udp, like you said). If it works faster, the problem is in the protocol, not in your code.
|
|
|
|
|
Is there a way to make the System.Windows.Forms.WebBrowser view only? I am currently controlling a WebBrowser programmatically and am allowing the user to "watch" but the user is still able to interact with the control.
I am trying to find a way to disable the user’s ability to interact with the WebBrowser while still being able to view what is inside the control.
Thank you all in advance!
Matt
|
|
|
|
|
Maybe the enabled property?
|
|
|
|
|
Unfortunately, the Enabled property is not supported by the WebBrowser control. =(
Any other ideas?
|
|
|
|
|