|
Ill try keep it short, Usually when I write networking applications, I spawn a new thread every time a client connects to the server. This works fine for my small time applications, but how do people who deploy large scale servers handle client communications? If you have thousands of users, for example a simple busy irc server, surely you cant spawn threads for all the users, what other methods are there?
Andy
|
|
|
|
|
If I remember correctly IRC uses UDP, so there's only a few inbound connections, and a big list that it broadcasts out to with all the clients. Usually with an upstream server in that list so the other server can handle it's list of clients as well. I do know several online games use something similar to handle their loads. Login servers redirect each connection to a different communication server, the communication servers have a private link between them to relay data, while each one broadcasts data out to it's list of clients. Leaving just a few connections from the comm servers going back to the application servers.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Hello all
I deploy my application using clickonce; When upgarde a new version, it is installed to client pc.
I want to know if the click once downloads each time all files existing for this version on the server on only the modified files; I mean if a dll didn't changed and i publish the application and put it on the server; is this dll re downloaded from the server or it it is copied from the previous version existing on client machine.
if this isn't the case; Can anyone help me to avoid downloading files not modified to client machine.
Best Regards
|
|
|
|
|
|
The code shown below is with which im messed up............
The problem is 'thread1' and 'thread2' are working simultaneously but the output is not in the correct format. Please check this out and please help with proper solution. I want both load_1() and load_2() to be shown properly. it is very urgent. Waiting for your reply!!!
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Loading
{
class loading
{
public static void load_1()
{
Console.SetCursorPosition(0, 2);
for (int l = 1; l <= 50; l++)
{
Console.Write("\\\b");
Thread.Sleep(50);
Console.Write("|\b");
Thread.Sleep(50);
Console.Write("/ \b");
Thread.Sleep(50);
Console.Write("\b");
Console.Write("|");
}
}
public static void load_2()
{
for (int load = 0; load <= 100; load++)
{
Thread.Sleep(10);
Console.SetCursorPosition(25, 4);
Console.Write("{0}%", load);
}
}
static void Main(string[] args)
{
Console.SetCursorPosition(16, 4);
Console.Write("LOADING:");
Thread thread1 = new Thread(new ThreadStart(load_1));
Thread thread2 = new Thread(new ThreadStart(load_2));
thread1.Start();
thread2.Start();
thread1.Join();
thread2.Join();
}
}
}
LINTO
|
|
|
|
|
linto_11 wrote: it is very urgent.
really? trying to fake an exam? snatching a job?
If noone else does I'll answer tomorrow.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Mr. Luc Pattyn, actually im searching answer for that code since 2 days. If u can give me the answer it would be very nice of you!!
LINTO
|
|
|
|
|
I would tell you the answer but it will takes me a few days to GUESS what your format is....
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
yeah mr. Pattyn it would be very nice of you
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I don't have too much expirence with writing to the console, so I'm having a hard time picturing what its actually doing. Assuming the load 2 is working and staying in one place, but load 1 is not, could it have something to do with the fact that on load1 you are not resetting the cursor position each time the for loop "ticks" but are in load 2? I'd imagine that load one goes through the loop the first time correctly, but then the next 50 times through it starts pushing the cursor to (0,3) (0,4) ect.
"You're damned if you do, and you're damned if you dont" - Bart Simpson
|
|
|
|
|
No, actually both load1 and load2 are workin simultaneously, but while execution the load2 is goin on executing while load1 is workin in the background! this is what irritating me!!
LINTO
|
|
|
|
|
Ah. I'm not really sure what the goal of the program is, but whenever I've done multi-threading apps I generally run into security and cross-threading errors. I've found (at least from a GUI) that it's sometimes easier to create an event handler and then fire the event from the background woker thread. I believe you still need to invoke the event though. Here's a good article on multi-threading: C# Multithreading
Hope it helps
"You're damned if you do, and you're damned if you dont" - Bart Simpson
|
|
|
|
|
Both the threads are perfectly working!!!! The problem lies with the cursorposition.
Because the load2 function changes the cursor position every time.
Have a Happy Coding.....
|
|
|
|
|
hello sir,
can you please tell me, How to run two threads simultaneously? It is a bit urgent!
LINTO
|
|
|
|
|
Don't bother, we will write the code and send it to you for free.
Ok, enough sarcasm. Here is where you start.[^]
Read that, get your hands on it. When you have issues or need more help on a particular area of the multithreading, post your question here.
|
|
|
|
|
|
see this[^] if you want the source code for it
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thread.Start();
Thread Start();
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
How can it be a bit urgent? Isnt that like being a bit pregnant?
|
|
|
|
|
J4amieC wrote: Isnt that like being a bit pregnant?
not at all. He wants an almost prompt delivery.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hello Masters,
Can you just put some light on which is the best way to invoke function's from a Win32 dll?
I have already studied the following ways:
Solution A: Create Bridge Functions and Use PInvoke.
Solution B: Create a Bridge DLL in Managed C++. If we don’t have the source code for the dll’s this approach would be better.
Also do we need to write a wrapper for each and every function a WIN32 dll exposes?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
If you are calling small amount of functions or performance is not very critical you can use P/Invoke approach. If performance is an issue, use managed c++
|
|
|
|
|
so you suggest to write a wrapper for the exposed functions from the dll in managed C++ before using them? I knowthat the number of functions in the C++ dll are more than what you would call manageable.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi,
I use P/Invoke to call native code. When I am in charge of the native code's API, I keep it as simple as possible, so not to rely on automatic marshaling which tends to cause data copying if one isn't careful.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I don't have the API's code available as well. Not being a C# developer can you please make me understand what is automatic marshalling and how can it be implemented.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|