473,498 Members | 310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asynchronous Sockets in .NET

I'm writing a Telnet Server application using
Asynchronous sockets.

I spawn a listener thread to handel incomming connections
and create a separate client socket for each new
connection.

I then set the new client socket to BeginReceive().

My problem: When two client socket connections send data
at the same time, the one socket connection reads the
data from both connections and the other connection's
Recieve Callback never fires.

I first dicovered this when I ported a C# sample to VB
that used the TCPClient and TCPListener objects. I then
read in the MSDN library that these objects are for
synchronous blocking communication only. Although it
worked fine otherwise.

I then re-wrote everything from scratch using just
sockets with the MSDN Library as the only reference. I
still get this same problem.

Any Ideas?
Jul 21 '05 #1
3 2800

Don't know work ok for me.

If you want I can give you c# sample app(SMTP/POP3/IMAP server) which work
ok with asynchronous socket.

For acceptiong connection I don't suggest use BeginAccept(), on hevy load
(>100 connections/sec) clients begin to recieve connect timeout.
Use socket.Accept() and put connetion to queue, add to your server queue
proccessing thread which starts sessions.

----Accept thread Thread
while running
Accpt
put to queue
-------------------------

--- Queue proc thread ----
while running
Just get queued connections and create sessions for them

------------------------

"Corne Oosthuizen" <co*********@shoprite.co.za> wrote in message
news:03****************************@phx.gbl...
I'm writing a Telnet Server application using
Asynchronous sockets.

I spawn a listener thread to handel incomming connections
and create a separate client socket for each new
connection.

I then set the new client socket to BeginReceive().

My problem: When two client socket connections send data
at the same time, the one socket connection reads the
data from both connections and the other connection's
Recieve Callback never fires.

I first dicovered this when I ported a C# sample to VB
that used the TCPClient and TCPListener objects. I then
read in the MSDN library that these objects are for
synchronous blocking communication only. Although it
worked fine otherwise.

I then re-wrote everything from scratch using just
sockets with the MSDN Library as the only reference. I
still get this same problem.

Any Ideas?

Jul 21 '05 #2
Hi Ivar,

I would appreciate it if you could give me some source
code.
It would be great if I could look at an example that
actually works.

Its good to know that BeginReceive() croacks on 100
connections /s

I am busy researching using both Asynchronous and
syncronous socket connections.

Thanks.
Corne.
-----Original Message-----

Don't know work ok for me.

If you want I can give you c# sample app(SMTP/POP3/IMAP server) which workok with asynchronous socket.

For acceptiong connection I don't suggest use BeginAccept (), on hevy load(>100 connections/sec) clients begin to recieve connect timeout.Use socket.Accept() and put connetion to queue, add to your server queueproccessing thread which starts sessions.

----Accept thread Thread
while running
Accpt
put to queue
-------------------------

--- Queue proc thread ----
while running
Just get queued connections and create sessions for them
------------------------

"Corne Oosthuizen" <co*********@shoprite.co.za> wrote in messagenews:03****************************@phx.gbl...
I'm writing a Telnet Server application using
Asynchronous sockets.

I spawn a listener thread to handel incomming connections and create a separate client socket for each new
connection.

I then set the new client socket to BeginReceive().

My problem: When two client socket connections send data at the same time, the one socket connection reads the
data from both connections and the other connection's
Recieve Callback never fires.

I first dicovered this when I ported a C# sample to VB
that used the TCPClient and TCPListener objects. I then
read in the MSDN library that these objects are for
synchronous blocking communication only. Although it
worked fine otherwise.

I then re-wrote everything from scratch using just
sockets with the MSDN Library as the only reference. I
still get this same problem.

Any Ideas?

.

Jul 21 '05 #3

See:
http://www.lumisoft.ee/lsWWW/Downloa...r/Devel/Async/

You can check this link for newer versions (see date), it's updated
frequently.

if you want discuss or have questions/suggestions write directly to my
email.

"Corne Oosthuizen" <co*********@shoprite.co.za> wrote in message
news:0c****************************@phx.gbl...
Hi Ivar,

I would appreciate it if you could give me some source
code.
It would be great if I could look at an example that
actually works.

Its good to know that BeginReceive() croacks on 100
connections /s

I am busy researching using both Asynchronous and
syncronous socket connections.

Thanks.
Corne.
-----Original Message-----

Don't know work ok for me.

If you want I can give you c# sample app(SMTP/POP3/IMAP

server) which work
ok with asynchronous socket.

For acceptiong connection I don't suggest use BeginAccept

(), on hevy load
(>100 connections/sec) clients begin to recieve connect

timeout.
Use socket.Accept() and put connetion to queue, add to

your server queue
proccessing thread which starts sessions.

----Accept thread Thread
while running
Accpt
put to queue
-------------------------

--- Queue proc thread ----
while running
Just get queued connections and create sessions for

them

------------------------

"Corne Oosthuizen" <co*********@shoprite.co.za> wrote in

message
news:03****************************@phx.gbl...
I'm writing a Telnet Server application using
Asynchronous sockets.

I spawn a listener thread to handel incomming connections and create a separate client socket for each new
connection.

I then set the new client socket to BeginReceive().

My problem: When two client socket connections send data at the same time, the one socket connection reads the
data from both connections and the other connection's
Recieve Callback never fires.

I first dicovered this when I ported a C# sample to VB
that used the TCPClient and TCPListener objects. I then
read in the MSDN library that these objects are for
synchronous blocking communication only. Although it
worked fine otherwise.

I then re-wrote everything from scratch using just
sockets with the MSDN Library as the only reference. I
still get this same problem.

Any Ideas?

.

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2466
by: Matthew King | last post by:
Hi all I've written a asynchronous socket client class, but i've found that in order to consume it I have to use events, and cannot simply for example SocketClient client = new...
9
8654
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am...
3
265
by: Corne Oosthuizen | last post by:
I'm writing a Telnet Server application using Asynchronous sockets. I spawn a listener thread to handel incomming connections and create a separate client socket for each new connection. I...
4
3793
by: taskswap | last post by:
I have a legacy application written in C that I'm trying to convert to C#. It processes a very large amount of data from many clients (actually, upstream servers - this is a mux) simultaneously. ...
4
2746
by: Macca | last post by:
I am writing an application that uses asynchronous sockets to get data over ethernet from embedded devices, up to 30 concurrent devices.(These devices are written in C). My application...
2
2169
by: Ronodev.Sen | last post by:
the way my program needs to go is -- 1) open a socket and listen on it 2) moment a client connects to the socket - process some data (by sending it to another machine), get the result and send...
4
3590
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket...
2
3409
by: Nicolas Le Gland | last post by:
Hello everyone here. This is my first post in this newsgroup, I hope I won't be to much off-topic. Feel free to redirect me to any better group. I am getting strange timing issues when...
0
1250
by: alan | last post by:
Hello all, I'd like to ask recommendations about a "good" generic asynchronous I/O library for C++. By generic I mean, something I can use even on files, stdin/stdout, and sockets. I've seen...
0
6998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7163
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,...
0
7200
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...
1
4904
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4586
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...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1416
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 ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
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...

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.