Use SuperSocket as a SMTP Server

Apr 8, 2013 at 7:54 PM
Hi,

I want use SuperSocket for a smtp receive Server. In the quickstart is no example available. If on a other place a howto available?

Best regards
Tino
Coordinator
Apr 9, 2013 at 3:17 AM
I think you didn't find the QuickStart, it locates in the QuickStart directory in the source code. There are a few sample projects in it.
Apr 9, 2013 at 9:43 AM
I have find the quickstart project but here is no example available for a smtp server.
Coordinator
Apr 9, 2013 at 9:49 AM
Of course, no. I cannot create all samples projects for all the specific applications.
Apr 9, 2013 at 11:36 AM
okay. thanks for info.
Apr 10, 2013 at 9:58 AM
Edited Apr 10, 2013 at 10:05 AM
Hi

My mail server now running. the log file write many errors from Threadppol worker.
Can i ignore this Error?

The only point on your code with this error is OnPerformanceTimerCallback.
I try to add here more log informations.

10:09:43,116 [Threadpool worker] ERROR MailServer-1810767872 [(null)] - Company.MailServer.Library.SuperSocketModul.SmtpSession
System.InvalidOperationException: Operation already in progress
at System.Net.Sockets.SocketAsyncEventArgs.SetLastOperation (SocketAsyncOperation op) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket+Worker.Init (System.Net.Sockets.Socket sock, System.Net.Sockets.SocketAsyncEventArgs args, SocketOperation op) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.ReceiveAsync (System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename unknown>:0
at SuperSocket.SocketEngine.AsyncSocketSession.StartReceive (System.Net.Sockets.SocketAsyncEventArgs e, Int32 offsetDelta) [0x00000] in <filename unknown>:0
Coordinator
Apr 10, 2013 at 10:29 AM
Which version of Supersocket are you using?
Apr 10, 2013 at 10:48 AM
Edited Apr 10, 2013 at 10:51 AM
Supersocket Version 1.5.1
Mono Version 2.10.8
Operating System: CentOS 6.4

12:28:29,341 [Threadpool worker] ERROR MailServer-1111465984 [(null)] - Company.Mailserver.Library.SuperSocketModul.SmtpSession
System.InvalidOperationException: Operation already in progress
at System.Net.Sockets.SocketAsyncEventArgs.SetLastOperation (SocketAsyncOperation op) [0x00039] in /root/mono-2.10.8/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs:186
at System.Net.Sockets.Socket+Worker.Init (System.Net.Sockets.Socket sock, System.Net.Sockets.SocketAsyncEventArgs args, SocketOperation op) [0x000a8] in /root/mono-2.10.8/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:491
at System.Net.Sockets.Socket.ReceiveAsync (System.Net.Sockets.SocketAsyncEventArgs e) [0x00063] in /root/mono-2.10.8/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1278
at SuperSocket.SocketEngine.AsyncSocketSession.StartReceive (System.Net.Sockets.SocketAsyncEventArgs e, Int32 offsetDelta) [0x00000] in <filename unknown>:0
Segmentation fault
Apr 10, 2013 at 12:26 PM
Okay i have found the source of the error message, but not the problem of the error.

https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs (Line 166)
Apr 11, 2013 at 8:52 AM
Edited Apr 11, 2013 at 8:53 AM
Today i switch my code to a Windows Server.

In the AppServerBase.cs on method OnNewSessionConnectedCallback i have a lot of errors.

10:47:43,011 [21] ERROR MailServer-25773083 [(null)] - System.NullReferenceException: Object reference not set to an instance of an object.

Server stack trace: 
   at SuperSocket.SocketEngine.AsyncSocketSession.ClearPrevSendState(SocketAsyncEventArgs e) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketEngine\AsyncSocketSession.cs:line 100
   at SuperSocket.SocketEngine.AsyncSocketSession.SendAsync(SendingQueue queue) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketEngine\AsyncSocketSession.cs:line 232
   at SuperSocket.SocketEngine.SocketSession.Send(SendingQueue queue) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketEngine\SocketSession.cs:line 256
   at SuperSocket.SocketEngine.SocketSession.StartSend(SendingQueue queue, Int32 sendingTrackID, Boolean initial) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketEngine\SocketSession.cs:line 322
   at SuperSocket.SocketEngine.SocketSession.TrySend(ArraySegment`1 segment) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketEngine\SocketSession.cs:line 232
   at SuperSocket.SocketBase.AppSession`2.InternalTrySend(ArraySegment`1 segment) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketBase\AppSession.cs:line 351
   at SuperSocket.SocketBase.AppSession`2.InternalSend(ArraySegment`1 segment) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketBase\AppSession.cs:line 377
   at SuperSocket.SocketBase.AppSession`2.Send(Byte[] data, Int32 offset, Int32 length) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketBase\AppSession.cs:line 334
   at SuperSocket.SocketBase.AppSession`2.Send(String message) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketBase\AppSession.cs:line 300
   at SuperSocket.SocketBase.AppSession`1.Send(String message) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketBase\AppSession.cs:line 671
   at Company.MailServer.Library.Core.MailServerCore.NewSessionConnected(SmtpSession session) in C:\Users\username\Documents\Visual Studio 2010\Projects\Company.MailServer\Company.MailServer.Library\Core\MailServerCore.cs:line 98
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at SuperSocket.SocketBase.SessionHandler`1.EndInvoke(IAsyncResult result)
   at SuperSocket.SocketBase.AppServerBase`2.OnNewSessionConnectedCallback(IAsyncResult result) in C:\Users\username\Documents\Visual Studio 2010\Projects\SuperSocket(1.5.1).Source\SocketBase\AppServerBase.cs:line 1341
Coordinator
Apr 11, 2013 at 9:23 AM
Oh, it's a known issue and it would be fixed in 1.6.
For now, dont' send data back to the client in the new session connected event handler. Instead, send back the data in the override method of the AppSession's method "OnSessionStarted()".
Coordinator
Apr 11, 2013 at 9:23 AM
BTW, upgrade your SuperSocket to 1.5.2.
Apr 11, 2013 at 2:44 PM
Hi Kerry can u please add known issues to wiki? Thanks so much

Sent from my iPad

Coordinator
Apr 12, 2013 at 9:51 AM