473,233 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

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 2771

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
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
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
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
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
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
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
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
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
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
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.