Vb SMTP Server - Huge Problem. Please help

A

Ajay

Hi

I am writing an SMTP server in VB.Net using the as Async
Socket Server Code in MSDN as the base. My problem is that
the port 25 socket Listener just stops accepting
connections after 10 to 20 secs.My listener loop is as
follows :

Public Shared Sub StartListening()
Dim localEndPoint As New IPEndPoint(ipAddress.Any, 25)

Dim f_oListener As New Socket(AddressFamily.InterNetwork,
SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
Try
f_oListener.Bind(localEndPoint)
f_oListener.Listen(100)
allDone.Reset()
While g_oServer.MainLoopRunning
f_oListener.BeginAccept(New AsyncCallback(AddressOf
AcceptCallback), f_oListener)
allDone.WaitOne()
End While

f_oListener.Close()
f_oListener = Nothing
End Try
End Sub 'StartListening

Am I running out of threads from the thread pool ? If so
how can I control that value. My SMTP server gets a lot of
traffic.

The exact same code works perfectly in my POP Server

Thanks for any input

Ajay
 
F

Fergus Cooney

Hi Ajay,

Have you put any debug variables to count things?

This isn't my area but when I see something like New AsyncCallback inside a loop it gets the old "how many oif these at once?"
question ringing.

Might it be useful to those that know more about these things to show what allDone is?

Regards,
Fergus
 
A

Ajay

Hi Fergus

Thanks for the suggestion. alldone is a ManualresetEvent

-Ajay
-----Original Message-----
Hi Ajay,

Have you put any debug variables to count things?

This isn't my area but when I see something like New
AsyncCallback inside a loop it gets the old "how many oif
these at once?"
question ringing.

Might it be useful to those that know more about
these things to show what allDone is?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top