473,563 Members | 2,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MultiThread Server with c# (you have a batter name?)

1 New Member
sorry for my poor english...

ok i tryed you build small server just for learning causes.
i used
BeginAccept & EndAccept.
the problem was that while i was debuging i noticed that only 1 user can work with the server at the same time and if another user try to connnect to the server before the callback of the first user was end he needs to wait.

for example if every user that connect to server gets hello message after 2 seconds then if 2 user connect at the same time one of them will get the hello message after 4 seconds....

some of my code:
first method:
IPEndPoint IpLocal = new IPEndPoint(IPAd dress.Any, this.port);
this.mainSocket .Bind(IpLocal);
this.mainSocket .Listen(4);
AsyncCallback callback = new AsyncCallback(O nClientConnect) ;
this.mainSocket .BeginAccept(ca llback, null);

then second method (the callback) do the EndAccept.

now for my question how can use threads and something else to solve the problem that only 1 user can connect to the server at the same time and others
need to wait for the callback to end?

tnx!
Sep 29 '07 #1
0 943

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7007
by: dbmethods | last post by:
Could someone give a hint on how to do multithread programming with PHP scripting here? Thanks
0
1602
by: Alice | last post by:
Hello I have four multithread windows applications(vb.net) interacting and running on the same machine(windows 2000 with .net framework 1.0). All of them start a new thread each time Filewatcher's created or deleted event is fired. One of these application writes data into word documents also in multithread fashion. Sometimes the created and...
0
1849
by: r_obert | last post by:
Hello, I'm trying to create a worker thread for my VC++ program, and was wondering whether I should be linking with the Multithread /MT or Multithread DLL /MD option? I'm not quite sure, in layman's terms, what the difference is. When I build with Multithread DLL, the linker complains about not being able to find a bunch of "unresolved...
4
7070
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a incoming connection,the relative code snipprt as following:: private IPAddress myIP=IPAddress.Parse("127.0.0.1"); private IPEndPoint myServer;...
2
26487
by: zhebincong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a incoming connection,the relative code snipprt as following:: private IPAddress myIP=IPAddress.Parse("127.0.0.1");
2
1448
by: N.Naeem | last post by:
Hi all I am a newbie to VB.NET hence I would like some help or pointers as to a way of developing the following: A server which listens on a particular port for incoming client connection. Upon receiving a connection the server starts to process data for that client and sends it back. In terms of data it will be a connection to Oracle, but...
0
1307
by: fred | last post by:
I need some help in trying to understand how to make myCollection (inherited from CollectionBase) multithread safe. Taking my implementation of the Add Sub and a readonly property Item. Public Sub Add(ByVal aDoc As myDocument) List.Add(aDoc) End Sub Can I make this multithread safe by and is this the best way to do it.
6
2816
by: jmartin | last post by:
Hi, I have made a multithread version of a program (load a file into database), and with two processors I get the double of time in the multithread than in the process (unithread) version. I have done the test of creating a unique thread that does the same code that the process version of the program and it takes more time that the...
2
5285
by: tikcireviva | last post by:
Hi Guys, I've done a mulithread queue implementation on stl<queue>, my developement environment is on VC6 as well as FC3. Let's talks about the win32 side. The suspected memory leak is find after I've run through my unit test cases. Test Case:
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.